private void btn_PDF_Click(object sender, EventArgs e)
 {
     using (FileStream pdfFileStream = new FileStream("OutputWorksheet.pdf", FileMode.Create))
     {
         workbook.ExportToPdf(pdfFileStream);
         MessageBox.Show("Your solution has been saved as PDF.");
     }
 }
Пример #2
0
        static void ExportToPdf(IWorkbook workbook)
        {
            workbook.Worksheets[0].Cells["D8"].Value = "This document is exported to the PDF format.";

            #region #ExportToPdf
            using (FileStream pdfFileStream = new FileStream("Documents\\Document_PDF.pdf", FileMode.Create)) {
                workbook.ExportToPdf(pdfFileStream);
            }
            #endregion #ExportToPdf
            Process.Start("Documents\\Document_PDF.pdf");
        }
Пример #3
0
        static void ExportToPdf(IWorkbook workbook)
        {
            #region #ExportToPdf
            Worksheet firstSheet = workbook.Worksheets[0];
            firstSheet.Cells["B2"].Value = "This document is exported to the PDF format";
            Table table = firstSheet.Tables.Add(firstSheet["A1:H30"], false);
            table.Style      = workbook.TableStyles[BuiltInTableStyleId.TableStyleMedium14];
            table.ShowTotals = true;
            table.Columns[0].TotalRowLabel = "Total";

            using (FileStream pdfFileStream = new FileStream("Document_PDF.pdf", FileMode.Create)) {
                workbook.ExportToPdf(pdfFileStream);
            }
            System.Diagnostics.Process.Start("Document_PDF.pdf");
            #endregion #ExportToPdf
        }