 |
ExcelToPdf Class |
Excel to Pdf Converter. This class offers the API needed to convert an Excel workbook (xlsx, xls,
csv and the other formats of
ExcelFormat) to pdf.
Inheritance HierarchySystemObject
SelectPdf.UniversalExcelToPdf
Namespace: SelectPdf.UniversalAssembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.6
SyntaxThe ExcelToPdf type exposes the following members.
Constructors| | Name | Description |
|---|
 | ExcelToPdf |
Initializes an instance of the Excel to Pdf converter.
|
Top
Properties| | Name | Description |
|---|
 | ConversionResult |
Gets a reference to an object that offers information about the result of the last
conversion; null before the first one.
|
 | Footer |
Gets a reference to an object that controls the properties of the custom footer of the
generated pdf document. Displayed when DisplayFooter is true.
|
 | Header |
Gets a reference to an object that controls the properties of the custom header of the
generated pdf document. Displayed when DisplayHeader is true.
|
 | Options |
Gets a reference to an object that controls the conversion process and the generated pdf
document properties.
|
Top
Methods| | Name | Description |
|---|
 | ConvertBytes(Byte) |
Converts a workbook held in memory to pdf. The format is detected from the content (xlsx family, xls,
SpreadsheetML, csv); tab-separated values and markdown must be named with
ConvertBytes(Byte, ExcelFormat).
|
 | ConvertBytes(Byte, ExcelFormat) |
Converts a workbook held in memory to pdf, reading it as the given format.
|
 | ConvertFile(String) |
Converts the workbook at the given path to pdf. The format is taken from the file extension, or
detected from the content when the extension is not one of the known ones.
|
 | ConvertFile(String, ExcelFormat) |
Converts the workbook at the given path to pdf, reading it as the given format.
|
 | ConvertStream(Stream) |
Converts the workbook read from a stream to pdf. The format is detected from the content (xlsx family,
xls, SpreadsheetML, csv); tab-separated values and markdown must be named with
ConvertStream(Stream, ExcelFormat).
|
 | ConvertStream(Stream, ExcelFormat) |
Converts the workbook read from a stream to pdf, reading it as the given format.
|
Top
Remarks
The result of the conversion is a
PdfDocument object that can be further modified,
saved to memory or into a file on the disk. The conversion runs in-process; no engine is
launched.
Options,
Header and
Footer mirror the html
and Word converters', so a document setup written for
HtmlToPdf applies here unchanged.
ExampleExcelToPdf converter = new ExcelToPdf();
converter.Options.MarginTop = 20;
PdfDocument doc = converter.ConvertFile("report.xlsx");
doc.Save("report.pdf");
doc.Close();Dim converter As New ExcelToPdf()
converter.Options.MarginTop = 20
Dim doc As PdfDocument = converter.ConvertFile("report.xlsx")
doc.Save("report.pdf")
doc.Close()
See Also