Free Support Forum - aspose.com

Xls file is showing very small after convertting to tiff

Hi,

I am using Aspose.Cells for Dotnet V 7.4.2.3.
When i tried to convert a specific xls file it is showing a small image after conversion.
Can you please help me to solve this issue.

Here i am attaching the original xls file and the converted tiff also.

Please find the below code which i am using to convert.

try
{
int sheetCount = 1;
//Initialize a new Workbook
            workbook = <span style="color:blue;">new</span> <span style="color:#2b91af;">Workbook</span>(FullInputFileName);
        
            sheets = workbook.Worksheets;

         
            <span style="color:blue;">foreach</span> (<span style="color:#2b91af;">Worksheet</span> sheet <span style="color:blue;">in</span> sheets)
            {
                <span style="color:green;">//Delete the Blank Rows from the worksheet</span>
                sheet.Cells.DeleteBlankRows();
              
                sheet.Cells.DeleteBlankColumns();
                <span style="color:blue;">if</span> (sheet.Cells.Count == 0)
                    <span style="color:blue;">continue</span>;
                <span style="color:blue;">if</span> (!sheet.IsVisible)
                    <span style="color:blue;">continue</span>;
                <span style="color:green;">//Apply different Image and Print options </span>
                <span style="color:#2b91af;">ImageOrPrintOptions</span> options = <span style="color:blue;">new</span> <span style="color:#2b91af;">ImageOrPrintOptions</span>();
                <span style="color:green;">//Set Horizontal Resolution</span>
                options.HorizontalResolution = 200;
                <span style="color:green;">//Set Vertical Resolution</span>
                options.VerticalResolution = 200;
                <span style="color:green;">//Set TiffCompression</span>
                options.TiffCompression = Aspose.Cells.Rendering.<span style="color:#2b91af;">TiffCompression</span>.CompressionCCITT4;
                <span style="color:green;">//Set Autofit options</span>
                options.IsCellAutoFit = <span style="color:blue;">false</span>;
                <span style="color:green;">//Set Image Format</span>
                options.ImageFormat = System.Drawing.Imaging.<span style="color:#2b91af;">ImageFormat</span>.Tiff;
                <span style="color:green;">//Set printing page type</span>
                options.PrintingPage = <span style="color:#2b91af;">PrintingPageType</span>.Default;
                <span style="color:green;">//Render the sheet with respect to specified image/print options</span>
                <span style="color:#2b91af;">SheetRender</span> sr = <span style="color:blue;">new</span> <span style="color:#2b91af;">SheetRender</span>(sheet, options);
                
                <span style="color:blue;">string</span> SheetName = <span style="color:#2b91af;">String</span>.Concat(<span style="color:#a31515;">"Sheet"</span>, sheetCount.ToString());
                <span style="color:blue;">string</span> FullSheetName = <span style="color:#2b91af;">Path</span>.Combine(<span style="color:#2b91af;">Path</span>.GetDirectoryName(FullInputFileName), SheetName);
               
               
                    <span style="color:blue;">for</span> (<span style="color:blue;">int</span> i = 0; i < sr.PageCount; i++)
                    {


                        <span style="color:green;">//sr.ToImage(0, FullSheetName);</span>
                        sr.ToImage(i, FullSheetName + i + <span style="color:#a31515;">".tiff"</span>);
                        fullconvertedMultiTiffName.Add(FullSheetName + i + <span style="color:#a31515;">".tiff"</span>);
                    }

                sheetCount++;
                <span style="color:green;">// Sheet render end</span>
            }
        }<br><br>Note: Please don't share the xls file to public<br><br>Regards<br>Anish<br></pre><br>

Hi,

Thanks for your posting and using Aspose.Cells for Net.

After initial investigation,we have found that this is not the error of Aspose.Cells.If you check the Ms-Excel print preview you will see the same small image. Aspose.Cells provided the output similar to Ms-Excel.

Please see the following screenshot for your reference.