Click or drag to resize

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.

Adding an Excel workbook to a page
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();
Options

A workbook can also be drawn in the header or footer of an HTML to PDF conversion with ExcelToPdfArea; see Headers and Footers.

See Also