We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

A4 Page Size XLS does not convert to tif at the right size in .NET

We are using Aspose Cells, 18.1.0.0 to convert an xls to a tif file (must be fax transmissible so its ccitt3).

The original xlsx is set to A4 size which is 21x29.71 centimeters. After conversion to tif with the code below, the size is incorrect at 19.8x31cm. We verify this with mspaint by opening the tif, and selecting file->properties->centimeters radio button.

Office automation converts this to the correct size. We are trying to move from Office automation to aspose.
The attached zip file includes

Issue9-1original.xlsx - the original zip file
Issue9-1original.TIFF - the tiff file created by aspose
Issue9-1old.tif - the tiff file created by office automation which has the correct dimensions.
details.png - A screen shot of mspaint giving the dimensions of the aspose created tif file. (incorrect size)

Issue9-1original.zip (117.8 KB)

Code used is (C#):

Aspose.Cells.License cellLicense = new Aspose.Cells.License();
cellLicense.SetLicense(“C:\interfax\Interfax20\OfficeRenderer\Service\License\Aspose.Total.lic”);
var asposeWorkbook = new Aspose.Cells.Workbook(“c:\dtemp\work\issue1-2original.xlsx”);

Aspose.Cells.Rendering.ImageOrPrintOptions CellsSaveOptions = null;
Aspose.Cells.Rendering.ImageOrPrintOptions cellRenderoptions = CellsSaveOptions;
var selectedWS = asposeWorkbook.Worksheets[0];
if (cellRenderoptions == null)

{

Aspose.Cells.PageSetup setup = selectedWS.PageSetup;
setup.PaperSize = Aspose.Cells.PaperSizeType.PaperA4;
int horizDpi = 170;
int vertDpi = 170;
cellRenderoptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();

// Set Horizontal Resolution
cellRenderoptions.SaveFormat = Aspose.Cells.SaveFormat.TIFF;
cellRenderoptions.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT3;

// Set Vertical Resolution
cellRenderoptions.VerticalResolution = vertDpi;
cellRenderoptions.HorizontalResolution = horizDpi;
cellRenderoptions.Quality = 100;
cellRenderoptions.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
cellRenderoptions.PixelFormat = System.Drawing.Imaging.PixelFormat.Format32bppArgb;

// If you want entire sheet as a single image
cellRenderoptions.OnePagePerSheet = false;

}

// Render to image

Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(selectedWS, cellRenderoptions);
sr.ToTiff(“c:\dtemp\work\out.tiff”);

@danwise,

Thanks for your query.
I have tried this scenario using latest version Aspose.Cells for .NET 18.11.x but could not observe this issue. The size of the resultant TIFF is similar to the original one. Please try the following latest version for your testing and provide your feedback.

Aspose.Cells18.11.6 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.11.6 For .Net4.0.Zip (4.7 MB)

I am still reproducing with the new dll. But I have two sets of test code I’m testing with and on one I get bad sizing and in the other I get good.

So I need to narrow down what the issue is. It may be completely in our code. Or it might be something else in Aspose.

You can close this and I’ll open another ticket when I determine the root cause if necessary. Thanks!

Actually please leave this open. I may have more info shortly.

@danwise,

You may please take your time to investigate the issue at your end and provide feedback at your ease. We will provide assistance as soon as some update is received from you.

OK yes you can close this. The issue I’m running into doesn’t happen when I convert to tiff with cells.

It does happen when I try to flip the tiff using Aspose imaging. I’ll create a ticket in the proper forum.

Thanks!

@danwise,

Thanks for your feedback. Good to know that you have sorted it out now. And, sure, please post your issue in Aspose.Imaging forum with all the details and samples.