ExcelConverter.DocumentParsing Event
Occurs when the Excel document is being analysed. At this stage various worksheet specific options can be set.
public event ExcelDocumentParsing ExcelConverter.DocumentParsing;
Public Event ExcelConverter.DocumentParsing As ExcelDocumentParsing
Event Handler
Licensing Info
This event is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Example shows how to apply conversion options to specific worksheet.Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' Create new instance of Converter by providing suitable parameters.
Dim excelConversion As ExcelConverter = New ExcelConverter("C:\MyDocument.xlsx")
' Events to know if conversion completed successfully or not
AddHandler excelConversionDocumentParsing, AddressOf xlConverter_DocumentParsing
' Call Convert method to start conversion
excelConversion.Convert("C:\MyOutput.pdf")
End Sub
Sub xlConverter_DocumentParsing(ByVal sender As Object, ByVal e As ExcelDocumentParsingEventArgs)
For Each excelWorksheet As ExcelWorksheet In e.Worksheets
Dim excelWSOptions As ExcelWorksheetConversionOptions = excelWorksheet.ConversionOptions
Dim xlPageScaling As ExcelPageScaling = excelWSOptions.PageScaling
Dim zoomxlPageScaling As ZoomExcelPageScaling = xlPageScaling.ZoomExcelPageScaling
zoomxlPageScaling.ZoomPercentage = 50
excelWorksheet.ConversionOptions.DefaultToFile = False
Next
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// Create new instance of Converter by providing suitable parameters.
ExcelConverter excelConverter = new ExcelConverter(@"C:\MyDocument.xlsx");
excelConverter.DocumentParsing += new ExcelDocumentParsing(xlConverter_DocumentParsing);
//Call Convert method to start conversion
excelConverter.Convert(@"C:\MyOutput.pdf");
}
static void xlConverter_DocumentParsing(object sender, ExcelDocumentParsingEventArgs e)
{
foreach (ExcelWorksheet excelWorksheet in e.Worksheets)
{
ExcelWorksheetConversionOptions excelWSOptions = excelWorksheet.ConversionOptions;
ExcelPageScaling xlPageScaling = excelWSOptions.PageScaling;
ZoomExcelPageScaling zoomxlPageScaling = xlPageScaling.ZoomExcelPageScaling;
zoomxlPageScaling.ZoomPercentage = 50;
excelWorksheet.ConversionOptions.DefaultToFile = false;
}
}
}
Remarks
See Reference of ExcelDocumentParsingEventArgs for details.