Excel |
The ExcelToPdfCPageStyleCPageScale type exposes the following members.
Name | Description | |
---|---|---|
![]() | Auto | Convert without any scaling. |
![]() | Equals | (Inherited from Object) |
![]() | FitByHeight | Fit each Excel sheet to a one PDF page depending of the page height. Thus, either to decrease the scale or leave as is if sheet could be fitted by page height. |
![]() | FitByWidth | Fit each Excel sheet to a one PDF page depending of the page width. Thus, either to decrease the scale or leave as is if sheet could be fitted by page width. This is the default option. |
![]() | GetHashCode | (Inherited from Object) |
![]() | GetType | (Inherited from Object) |
![]() | Percent | Allows to specify page scale in percentages: from 1...10000. |
![]() | ScaleByHeight | Make the scale the same as PDF page height. Thus, either to decrease or to increase scale. |
![]() | ScaleByWidth | Make the scale the same as PDF page width. Thus, either to decrease or to increase scale. |
![]() | ScaleToOnePage | Make the scale close as possible to page size to fit the sheet into a single page. Simultaneously takes care of page width and height. |
![]() | ToString | (Inherited from Object) |
using System; using System.IO; using SautinSoft; namespace Sample { class Sample { static void Main(string[] args) { // Fit each sheet to a single page fixed size. ExcelToPdf x = new ExcelToPdf(); // Fit each sheet to single PDF page, A4 format. x.PageStyle.PageSize.A4(); x.PageStyle.PageScale.Auto(); // Set PDF as output format. x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Pdf; string excelFile = Path.GetFullPath(@"..\..\test.xlsx"); 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() ' Fit each sheet to a single page fixed size. Dim x As New ExcelToPdf() 'Fit each sheet to single PDF page, A4 format. x.PageStyle.PageSize.A4() x.PageStyle.PageScale.Auto() ' Set PDF as output format. x.OutputFormat = SautinSoft.ExcelToPdf.eOutputFormat.Pdf Dim excelFile As String = Path.GetFullPath("..\test.xlsx") 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