Allows to specify which custom sheets and cells will be exported into PDF, Word

Namespace:  SautinSoft
Assembly:  SautinSoft.ExcelToPdf (in SautinSoft.ExcelToPdf.dll) Version: 5.1.7.22

Syntax

      
 C#  Visual Basic 
public class PrintedArea
Public Class PrintedArea

Members

         
 All Members  Constructors   Methods  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
ExcelToPdf..::.CSheet..::.PrintedArea()()()
Creates a new instance of ExcelToPdf..::.CSheet..::.PrintedArea class
Add(String, String, array<Int32>[]()[])
Adds custom area to export in PDF, Word
Add(Int32, Int32, Int32, Int32, array<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

Remarks

Examples

CopyExport to PDF only custom area from sheet in C#
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();
            }
        }
    }
}
CopyExport to PDF only custom area from sheet in VB.Net
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

Inheritance Hierarchy

System..::.Object
  SautinSoft..::.ExcelToPdf..::.CSheet..::.PrintedArea

See Also