Exporting Excel to Tiff

Hi,

in Aspose.Words and Aspose.Slides, you can export the document to Tiff format. This is not available in Aspose.Cells.

Are there any plans for adding the same options to Aspose.Cells, as are available in Aspose.Words and Slides? If not, can you please add this to your requested feature list?

Regards

Thomas

Hi,

You can export your worksheet to tiff image. Please see the code below.

C#


//Create a new Workbook object

//Open a template excel file

Workbook book = new Workbook(“C:\Testbook.xls”);


//Get the first worksheet.

Worksheet sheet = book.Worksheets[0];


//Define ImageOrPrintOptions

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();


//Specify the image format

imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff;


//Render the sheet with respect to specified image/print options

SheetRender sr = new SheetRender(sheet, imgOptions);


//Render the image for the sheet

Bitmap bitmap = sr.ToImage(0);


//Save the image file

bitmap.Save(@“D:\SheetImage.tiff”);




Oh, thanks - I didn't knwo that.

The Sheetrendere, it renders just the first sheet, correct? Or does it render them all, so I can get the individual sheets from sr.ToImage(sheetNumber)?

if so, I will have to handle multipage tiff's my self, correct?

In Aspose.Words you can set the DPI, colordepth and compression for the TIFF document, will this be available in Aspose.Cells?

Regards

Thomas

Hi,

You have different options, you can take a single image of entire worksheet or you can get image in multiple pages.

Please see the full article: Converting Worksheet to Image and Worksheet to Image by Page

Secondly, you will have to iterate all your worksheets inside your workbook and get the image of each worksheet separately.

Also, there is ImageOrPrintOptions.TiffCompression property, where TiffCompression can be

CompressionNone : Specifies no compression. 0
CompressionRle : Specifies the RLE compression scheme. 1
CompressionLZW : Specifies the LZW compression scheme. 2
CompressionCCITT3 : Specifies the CCITT3 compression scheme. 3
CompressionCCITT4 : Specifies the CCITT4 compression scheme. 4

Please see if it fulfills your need.

Hi,


If you are looking for a feature to generate MultiPage Tiff files then you should see WorkbookRender Class under the Aspose.Cells.Rendering namespace. Below is the sample code, also the input and output files are attached for your reference.

C#

Workbook book = new Workbook(“c:\temp\aWorkbook.xlsx”);

ImageOrPrintOptions options = new ImageOrPrintOptions();

options.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff;

options.OnePagePerSheet = true;

WorkbookRender bookRender = new WorkbookRender(book, options);

bookRender.ToImage(“C:\temp\bookrender.tiff”); //Generate multipage Tiff



Note: I am using Windows Photo Viewer to examine the Tiff file

Hi all,

thanks for the replys - it's exactly what I'm looking for :-)

Regards

Thomas