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”);