Excel |
The ExcelToPdf type exposes the following members.
Name | Description | |
---|---|---|
ExcelToPdf | Creates a new instance of ExcelToPdf class |
Name | Description | |
---|---|---|
ColumnsToConvertLimit | The number of maximum processed columns in the table. | |
CreateTraceFile | Gets or sets whether to create a trace file. Default value: false. | |
Options | Set up the info block properties for resulting documents, such as file version and a document producer. | |
OutputFormat | Specify format for output file: PDF, Word, RTF etc. Default value: Pdf. | |
PageStyle | Contains page properties for output PDF document: page size, orientation, page margins and put page numbers. | |
Serial | A string which contains a serial number to activate your copy after purchasing. Use it when you got own serial number and registered version. | |
Sheets | Set custom sheets for converting. By default all sheets from workbook will be converted. | |
TraceFilePath | Path to create a tracing file. Allows to track issues and exceptions which appeared during the conversion cycle. Default value: "C:\trace.txt" | |
UnicodeOptions | Allows to specify options to properly convert Unicode, such as "Fonts" directory etc |
Name | Description | |
---|---|---|
ConvertBytes | Convert Excel bytes array to PDF, Word, RTF bytes array | |
ConvertByteToFile | Convert Excel bytes array to PDF, Word, RTF file. Output file will be created by component or overwritten if already exist | |
ConvertFile | Convert Excel file to PDF, Word file. PDF file will be created by component or overwritten if already exist | |
ConvertFiletoBytes | Convert Excel file to PDF, Word bytes array | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
GetHashCode | Serves as the default hash function. (Inherited from Object) | |
GetSheetsNumber(Byte) | Returns numbers of sheets from Excel workbook | |
GetSheetsNumber(String) | Returns numbers of sheets from Excel workbook | |
GetType | Gets the Type of the current instance. (Inherited from Object) | |
SetLicense | A string which contains a serial number to activate your copy after purchasing. Use it when you got own serial number and registered version. SetLicense("1234567890") | |
ToString | Returns a string that represents the current object. (Inherited from Object) |
Name | Description | |
---|---|---|
XlsxFormat | Get or set the flag that the format of the input file is xlsx.(else xls) Defaut: true. |
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Result.Text = ""; } protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.PostedFile.FileName.Length == 0 || FileUpload1.FileBytes.Length==0) { Result.Text = "Please select an Excel document for conversion!"; return; } SautinSoft.ExcelToPdf x = new SautinSoft.ExcelToPdf(); x.PageStyle.PageSize.Letter(); byte[] pdfBytes = null; try { pdfBytes = x.ConvertBytes(FileUpload1.FileBytes); } catch { } //show PDF if (pdfBytes != null) { Response.Buffer = true; Response.Clear(); Response.ContentType = "application/PDF"; Response.AppendHeader("content-disposition", "attachment; filename=Result.pdf"); Response.BinaryWrite(pdfBytes); Response.Flush(); Response.End(); } else { Result.Text = "Converting failed!"; } } }
Imports System Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.IO Partial Public Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Result.Text = "" End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) If FileUpload1.PostedFile.FileName.Length = 0 OrElse FileUpload1.FileBytes.Length=0 Then Result.Text = "Please select an Excel document for conversion!" Return End If Result.Text = "Converting ..." Dim x As New SautinSoft.ExcelToPdf() x.PageStyle.PageSize.Letter() Dim pdfBytes() As Byte = Nothing Try pdfBytes = x.ConvertBytes(FileUpload1.FileBytes) Catch End Try 'show PDF If pdfBytes IsNot Nothing Then Response.Buffer = True Response.Clear() Response.ContentType = "application/PDF" Response.BinaryWrite(pdfBytes) Response.Flush() Response.End() Else Result.Text = "Converting failed!" End If End Sub End Class