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

Free Support Forum - aspose.com

Xlsm file is not converting

Hi,

I am using aspose.cells v 7.5.3.4 to convert excel related files .
For large files as attached , i am converting only first portion of the page as described in the code.
But the attached file is not converting. Can you please check?

public static List ConvertExcelToTiffNoPassword(string OutputFolder, string FullInputFileName)
{

List fullconvertedMultiTiffName = new List();
Workbook workbook = null;
WorksheetCollection sheets = null;
bool onepage = true;
try
{
int sheetCount = 1;
workbook = new Workbook(FullInputFileName);
sheets = workbook.Worksheets;
//For email FTP
if (sheets.Count >= Convert.ToInt32(ConfigurationManager.AppSettings[“SheetCount”].ToString()))
{
onepage = false;
}

foreach (Worksheet sheet in sheets)
{

// sheet.Cells.DeleteBlankRows();
// sheet.Cells.DeleteBlankColumns();
if (sheet.Cells.Count == 0 && sheet.Pictures.Count == 0)
continue;
if (!sheet.IsVisible)
continue;
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.HorizontalResolution = 300;
options.VerticalResolution = 300;
options.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionCCITT4;
options.IsCellAutoFit = false;
options.ImageFormat = ImageFormat.Tiff;
options.PrintingPage = PrintingPageType.Default;
sheet.AutoFitColumns();
sheet.AutoFitRows();
SheetRender sr = new SheetRender(sheet, options);
if (sheet.Pictures.Count >= 1)
{
Picture pic = sheet.Pictures[0];
pic.FormatPicture.Brightness = 1.0F;
}
string SheetName = String.Concat(“Sheet”, sheetCount.ToString());
string FullSheetName = Path.Combine(Path.GetDirectoryName(FullInputFileName), SheetName);
int pageCount = Convert.ToInt32(ConfigurationManager.AppSettings[“ExcelPage”].ToString());
if (sr.PageCount > pageCount || onepage == false)
{

sr.ToImage(0, FullSheetName + 0 + “.tiff”);

fullconvertedMultiTiffName.Add(FullSheetName + 0 + “.tiff”);

break;
}
else
{
for (int i = 0; i < sr.PageCount; i++)
{

sr.ToImage(i, FullSheetName + i + “.tiff”);
fullconvertedMultiTiffName.Add(FullSheetName + i + “.tiff”);
}
}
sheetCount++;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
workbook = null;
sheets = null;
}
return fullconvertedMultiTiffName;
}




Regards
Anish

Hi Anish,


Thank you for contacting Aspose support.

We have evaluated your presented scenario while using the latest version of Aspose.Cells for .NET 8.1.0, and your provided code snippet with little modifications. Please note, due to the size of the data in the sample spreadsheet, the process takes some time to render it. It advised that you should use the Memory Optimization settings while loading such a large file to reduce the overall memory cost.

C#

LoadOptions load = new LoadOptions();
load.MemorySetting = MemorySetting.MemoryPreference;
workbook = new Workbook(FullInputFileName, load);

In case the problem persists, please provide the values for SheetCount & ExcelPage that your code picks from the configuration file. Please note, for now we have hard codded these values for testing purposes.