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

Free Support Forum - aspose.com

Aspose not converting Exce file to tiff

Hi Aspose Team,
I am using Aspose.Cells component to convert excel file to tiff.
But i got an excel file which is contains an image attached.
And it is not converting the file to tiff.

Can you please help me on this.
I am attaching the excel file

Please see the code which i am using.

 List<string> fullconvertedMultiTiffName = new List<string>();
Workbook workbook = null;
WorksheetCollection sheets = null;
int sheetCount = 1;
//Initialize a new Workbook
            workbook = <span style="color:blue;">new</span> <span style="color:#2b91af;">Workbook</span>(FullInputFileName);
            <span style="color:green;">//Delete blank rows and columns</span>
            <span style="color:green;">//Create a Worksheets object with reference to </span>
            <span style="color:green;">//the sheets of the Workbook.</span>
            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>
                <span style="color:green;">//Delete the Blank Columns from the worksheet</span>
                <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:#a31515;">".tiff"</span>);
                <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:green;">//Render/save the image for the sheet</span>


I have tested your code (with little adjustments accordingly for my pc) with latest fix: Aspose.Cells for .NET v7.3.3.3 it works fine. The output tiff image is fine having the picture as per the Excel’s print preview shown in MS Excel.

Please try our latest fix v7.3.3.3.

Sample code:

Workbook workbook = new Workbook(“e:\test2\Brubaker%2c+Edward+SOE+10-27-12.xls”);
//Delete blank rows and columns
//Create a Worksheets object with reference to
//the sheets of the Workbook.
WorksheetCollection sheets = workbook.Worksheets;
Worksheet sheet = sheets[0];
//Delete the Blank Rows from the worksheet
//Delete the Blank Columns from the worksheet
//Apply different Image and Print options
ImageOrPrintOptions options = new ImageOrPrintOptions();
//Set Horizontal Resolution
options.HorizontalResolution = 200;
//Set Vertical Resolution
options.VerticalResolution = 200;
//Set TiffCompression
options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;
//Set Autofit options
options.IsCellAutoFit = false;
//Set Image Format
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff;
//Set printing page type
options.PrintingPage = PrintingPageType.Default;
//Render the sheet with respect to specified image/print options
SheetRender sr = new SheetRender(sheet, options);
//Render/save the image for the sheet