Excel to pdf1

hi,
Anyone can tell , I want only selected range excel data save as pdf how can i do it?
is it possible?

@yogitagaikwad2206,

Try solutions of these thread.

Thanksm
Ashok :slight_smile:

when i do this means read range then write range i don’t want that beacause my excel table has multiple color in cell so i want as it is table save as pdf how can i do this
like below…

Hi @yogitagaikwad2206

Check the below Thread

can i copy selected range with its color and paste in other excel

Hi Yogita,

As per your query, also there is an dedicated package called ‘ExcelToPDFConversion.Activities’

Cheers…

Hi @yogitagaikwad2206

Check the below thread

Regards,

here option is disabled

i want copy excel selected data with its color & paste in other excel with its color

Hi Yogita,

Try this it work…
Open this youtube link :- https://www.youtube.com/watch?v=Z5ko-Ub-cdY

this video guide you better.

Cheers…

but here range of excel is not selected

can anyone help me for doing this?

If you are allowed to use Invoke Code and have the Excel Desktop app installed, you can use Microsoft.Office.Interop.Excel to do what you want.

Code:

Dim excelApp As New Microsoft.Office.Interop.Excel.Application()
Dim workbook As Microsoft.Office.Interop.Excel.Workbook = Nothing
Dim worksheet As Microsoft.Office.Interop.Excel.Worksheet = Nothing

Try
    workbook = excelApp.Workbooks.Open(in_ExcelFile)
    ' Get the first worksheet
    worksheet = CType(workbook.Sheets(1), Microsoft.Office.Interop.Excel.Worksheet)

    Dim range As Microsoft.Office.Interop.Excel.Range = worksheet.Range(in_Range)
    range.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, in_PdfFile)

    Console.WriteLine("PDF saved successfully at " & in_PdfFile)
Catch ex As Exception
    Console.WriteLine("Error: " & ex.Message)
Finally
    ' Clean up
    If Not worksheet Is Nothing Then System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet)
    If Not workbook Is Nothing Then
        workbook.Close(False)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook)
    End If
    excelApp.Quit()
    System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp)
End Try

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.