Using excelEngine As ExcelEngine = New ExcelEngine()
'Instantiate the application object
Dim application As IApplication = excelEngine.Excel
'Open the template workbook with dummy data
Dim workbook As IWorkbook = application.Workbooks.Open("Input.xlsx", ExcelOpenType.Automatic)
'Accessing the first worksheet and range to print
Dim worksheet As IWorksheet = workbook.Worksheets(0)
Dim sourceRange As IRange = worksheet.Range("A1:L12")
'Create a new worksheet and copy the range
Dim worksheet1 As IWorksheet = workbook.Worksheets.Create("NewSheet")
Dim destinationRange As IRange = worksheet1.Range("A1:L12")
sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.All)
'Print the worksheet with the range
Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(worksheet1)
converter.Print()
End Using |
Query |
Response | |
question1a: I have seen the papersize option, but does syncfusion have a built-in name lister and am I just calling the name instead of looking up and converting? Something like this? |
Kindly make use of the ExcelPaperSize enumeration for your requirement. | |
question1b: Can I print only charts or embedded charts? |
Yes, you can print a chart by using the following code snippet.
Code snippet:
| |
question1c: if i print entire workbook, how i can custom zoom page? |
When printing entire workbook, the following code snippet helps in custom zooming.
Code snippet:
| |
question1d: Is there any difference between sheet.zoom=120 and pdfview...ScalePercentage = 120? |
sheet.Zoom property is used when you want the saved Excel workbook to be zoomed.
sheet.PageSetup.Zoom is used when you want the converted/printed PDF document to be zoomed.
pdfViewer.PrinterSettings.ScalePercentage is used when you load a PDF document using PDFViewer control and print using PrinterSettings in it.
| |
question2: Why are they(pdforientation and pdfviewprintorientation enum not equals) with each other?
|
PdfPageOrientation is used to set the page orientation (Portrait or Landscape) while creating the PDF document.
Note: Default value of this Enum is Portrait.
PdfViewerPrintOrientation is related to the orientation of the printed output paper dimensions. Since the printed output paper dimension is not related to the PDF page dimension, their values are not necessary to be equal. However, you can set the required orientation to the printer settings property. Please refer to the UG link below.
| |
question3: can you explain more excel2pdf not support Row and column headings mean? because I see in sheet.pagesetup still have printgridline / printheading? |
PrintHeadings property is applicable to show or hide heading in Excel workbooks and this support is not available in PDF conversion. | |
question4: I have many of the same settings for sheets in same workbook(not all), when loop printing can I use a template pagesetup or do I still have to set up all settings for each sheet? |
Template PageSetup for an workbook is not available. You need to set up the PageSetup options for each sheet in a single ForEach loop, as we did in the code given for custom zoom page. |
my sample file from 1.b(print to pdf). Can you try it for me please?. When I loaded into pdfviewcontrol it was an empty file
Query |
Response | |
how to automatic set orientation of Ichartshape?, such as:
if chart.height > chart.width then
.orientation = portraint
else
.orientation=lanspcape
end if
|
It is not possible to set orientation of IChartShape. You can set orientation to worksheet PageSetup with ExcelPageOrientation enumeration as below.
| |
Also if I want to reset pagesetup.PrintTitleRows to "default" what should I do? (i try: pagesetup.PrintTitleRows"" but i get an error)
|
You can set PrintTitleRows property to string in A1-style notation alone, which means you can refer to a cell or a range of cells. Also, we are not facing any error on setting empty string. Kindly share us the code used and the error details for further analysis. | |
and
with question 1b: can i print Ichartshape as your code provide?
|
Yes, you can print with IChartShape objects too. | |
my sample file from 1.b(print to pdf). Can you try it for me please?. When I loaded into pdfviewcontrol it was an empty file
|
The given sample file is properly converted to PDF with ExcelToPDFConverter and charts in the file are also getting printed properly. Kindly ensure whether you have initialized ChartToImageConverter as below to print charts.
Also, kindly confirm us whether you are using ExcelToPDFConverter or PDFViewer code. If you are still facing the issue, kindly share us the code snippet that you are using at your end, so that we can give prompt solution at the earliest.
|
Query |
Response | |
1. It is not possible to set orientation of IChartShape.
yes, so Can I access its height and width of IChartshape so that I can set pagesetup.orientation?
|
We are checking this requirement and will let you know the details on June 9th, 2020. | |
I have problems with printtilerow = "" when print to pdf. |
Kindly share us the issue reproducing sample as requested in our previous update, which will be helpful for us in investigating the query. | |
3,4 Sorry I forgot to mention printing them to pdf. (not convert.print ()) |
Excel charts can alone be converted to PDF, by initializing ChartToImageConverter and parsing the chart object in ExcelToPdfConverter.
Please look into the code below.
If you still face any issue, kindly share us the issue reproducing sample. |
chart.PrimaryValueAxis.MinimumValue = 0.0
chart.PrimaryValueAxis.MaximumValue = 1.0
chart.PrimaryValueAxis.MinorUnit = 0.02
chart.PrimaryValueAxis.MajorUnit = 0.1 |
Query |
Response | ||
Can I access height and width of IChartshape? |
You can access height and width of IChartShape using any of the following code snippets.
Code snippets:
(or)
| ||
can i import from excelfile with a defined area to datagrid but they contain images (in each row). |
Kindly look into the following KB to export Excel to DataGrid.
But, we don’t have support to export images in an Excel file to DataGrid. |