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,
LoadOptions load = new LoadOptions();
load.MemorySetting = MemorySetting.MemoryPreference;
workbook = new Workbook(FullInputFileName, load);