Excel |
The ExcelToPdfCSheetPrintedArea type exposes the following members.
Name | Description | |
---|---|---|
![]() | ExcelToPdfCSheetPrintedArea | Creates a new instance of ExcelToPdfCSheetPrintedArea class |
Name | Description | |
---|---|---|
![]() ![]() | Add(String, String, Int32) | Adds custom area to export in PDF, Word |
![]() ![]() | Add(Int32, Int32, Int32, Int32, Int32) | Adds custom area to export in PDF, Word by column and row numbers. |
![]() | Clear | Mark all sheets and cells in workbook to export into PDF, Word |
![]() | Equals | (Inherited from Object) |
![]() | GetHashCode | (Inherited from Object) |
![]() | GetType | (Inherited from Object) |
![]() | ToString | (Inherited from Object) |
using System; using System.IO; using SautinSoft; namespace Sample { class Sample { static void Main(string[] args) { // Set custom area to convert. ExcelToPdf x = new ExcelToPdf(); x.PageStyle.PageSize.Letter(); // Set PDF as output format. x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Pdf; // Let's convert only rectangle from "B6" to "C9" on sheet 1. x.Sheets.PrintArea.Add("B6", "C9", new int[]{1}); string excelFile = Path.GetFullPath(@"..\..\test.xls"); string pdfFile = Path.ChangeExtension(excelFile, ".pdf"); ; try { x.ConvertFile(excelFile, pdfFile); System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(pdfFile) { UseShellExecute = true }); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadLine(); } } } }
Imports System Imports System.IO Imports SautinSoft Module Sample Sub Main() ' Set custom area to convert. Dim x As New ExcelToPdf() x.PageStyle.PageSize.Letter() ' Set PDF as output format. x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Pdf ' Let's convert only rectangle from "B6" to "C9" on sheet 1. x.Sheets.PrintArea.Add("B6", "C9", New Integer() {1}) Dim excelFile As String = Path.GetFullPath("..\test.xls") Dim pdfFile As String = Path.ChangeExtension(excelFile, ".pdf") Try x.ConvertFile(excelFile, pdfFile) System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(pdfFile) With {.UseShellExecute = True}) Catch ex As Exception Console.WriteLine(ex.Message) Console.ReadLine() End Try End Sub End Module