-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathExportActions.cs
36 lines (33 loc) · 1.02 KB
/
ExportActions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.IO;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Collections.Generic;
using DevExpress.Spreadsheet;
namespace SpreadsheetExamples
{
public static class ExportActions
{
#region Actions
public static Action<Workbook> ExportToPdfAction = ExportToPdf;
#endregion
static void ExportToPdf(Workbook workbook)
{
workbook.Worksheets[0].Cells["D8"].Value = "This document is exported to the PDF format.";
#region #ExportToPdf
// Export the workbook to PDF.
using (FileStream pdfFileStream = new FileStream("Documents\\Document_PDF.pdf", FileMode.Create))
{
workbook.ExportToPdf(pdfFileStream);
}
#endregion #ExportToPdf
var p = new Process();
p.StartInfo = new ProcessStartInfo(@"Documents\Document_PDF.pdf")
{
UseShellExecute = true
};
p.Start();
}
}
}