Class WorkbookRender

WorkbookRender class

Represents a Workbook render. The constructor of this class , must be used after modification of pagesetup, cell style.

public class WorkbookRender

Constructors

NameDescription
WorkbookRender(Workbook, ImageOrPrintOptions)The construct of WorkbookRender

Properties

NameDescription
PageCount { get; }Gets the total page count of workbook.

Methods

NameDescription
CustomPrint(bool, PrintPageEventArgs)Client can control page setting of printer when print each page using this function.
Dispose()Releases resources created and used for rendering.
GetPageSizeInch(int)Get page size in inch of output image.
ToImage(int)Render certain page to a Bitmap object.
ToImage(Stream)Render whole workbook as Tiff Image to stream.
ToImage(string)Render whole workbook as Tiff Image to a file.
ToImage(int, Stream)Render certain page to a stream.
ToImage(int, string)Render certain page to a file.
ToPrinter(PrinterSettings)Render workbook to Printer
ToPrinter(string)Render workbook to Printer
ToPrinter(PrinterSettings, string)Render workbook to Printer
ToPrinter(string, string)Render workbook to Printer
ToPrinter(string, int, int)(Obsolete.) Render workbook to Printer

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Rendering;

namespace AsposeCellsExamples
{
    public class RenderingClassWorkbookRenderDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];
            
            // Add sample data and set page size
            worksheet.Cells["A1"].PutValue("Workbook Render Demo");
            worksheet.PageSetup.PaperSize = PaperSizeType.PaperLetter;

            // Create image options
            ImageOrPrintOptions options = new ImageOrPrintOptions();
            
            // Create workbook render and get page size
            WorkbookRender render = new WorkbookRender(workbook, options);
            float[] pageSize = render.GetPageSizeInch(0);
            
            // Output the results
            Console.WriteLine($"Page Width: {pageSize[0]} inches");
            Console.WriteLine($"Page Height: {pageSize[1]} inches");
        }
    }
}

See Also