Excel to PDF Element |
ExcelToPdfElement draws an Excel workbook - .xlsx, .xls, .csv and the other formats of the Excel to PDF converter - at a position on a PDF page, like Word to PDF Element does for a Word document. Every sheet is laid out on pages the size of the element, and a workbook longer than the page continues on the following pages.
using ExpertPdf.Anywhere.PdfDocument; Document document = new Document(); PdfPage page = document.AddPage(); PdfFont font = document.AddFont(StdFontBaseFamily.HelveticaBold); page.AddElement(new TextElement(0, 0, "Quarterly figures", font)); // the workbook below the title, the full width of the page, all the columns of // each sheet on that width; it continues on new pages ExcelToPdfElement sheet = new ExcelToPdfElement(0, 30, "sales.xlsx"); sheet.Layout = ExpertPdf.Anywhere.ExcelToPdf.ExcelLayout.FitAllColumnsOnOnePage; page.AddElement(sheet); document.Save("report.pdf"); document.Close();
The constructors take the position, optionally a width and a height, and a file path or a stream. With a height, only that much of the workbook is drawn.
Format, Password, Worksheets, Layout, GridLines, PageRanges and SheetBookmarks: as on the Excel to PDF converter.
LiveUrlsEnabled and InternalLinksEnabled: keep the links of the workbook.
Tagged: in a tagged document, the workbook's tables, charts, pictures and links join the structure of the document.
PdfPagesRectangles: after the element is added, where it was drawn on each page.
A workbook can also be drawn in the header or footer of an HTML to PDF conversion with ExcelToPdfArea; see Headers and Footers.