Hi Ahsan,
We are using the aspose version :19.9
OS :Windows 10
Im pasting the code which is been used to convert document to tiff
ExcelSheetMultitiffs =ConvertExcelToTiff(MultiTiffFolder,fInfo.FullName,password);
public static List ConvertExcelToTiff(string OutputFolder, string FullInputFileName, string password)
{
//onepage variable is use to manage large excel file.
List fullconvertedMultiTiffName = new List();
Workbook workbook = null;
WorksheetCollection sheets = null;
bool onepage = true;
try
{
int sheetCount = 1;
//Initialize a new Workbook
Aspose.Cells.LoadOptions loadOptions = new Aspose.Cells.LoadOptions();
loadOptions.Password = password;
loadOptions.MemorySetting = MemorySetting.MemoryPreference;
workbook = new Workbook(FullInputFileName, loadOptions);
workbook.Save(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;
//Apply different Image and Print options
ImageOrPrintOptions options = new ImageOrPrintOptions();
//Set Horizontal Resolution
options.HorizontalResolution = 300;
//Set Vertical Resolution
options.VerticalResolution = 300;
//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;
sheet.AutoFitColumns();
sheet.AutoFitRows();
//Render the sheet with respect to specified image/print options
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());
//commented by shine
if (sr.PageCount < pageCount)
pageCount = sr.PageCount;
//if (sr.PageCount > pageCount || onepage == false)
//{
// sr.ToImage(1, FullSheetName + 1 + ".tiff");
// fullconvertedMultiTiffName.Add(FullSheetName + 1 + ".tiff");
//}
//else
if(sr.PageCount > 0)
{
//for (int i = 0; i < sr.PageCount; i++)
for (int i = 0; i < pageCount; i++)
{
//sr.ToImage(0, FullSheetName);
sr.ToImage(i, FullSheetName + i + ".tiff");
fullconvertedMultiTiffName.Add(FullSheetName + i + ".tiff");
}
}
sheetCount++;
}
}
public static void ResizeLargeImage(Shape image)
{
if (!image.HasImage)
return;
PageSetup ps = image.ParentParagraph.ParentSection.PageSetup;
double freePageWidth = image.IsInline ? ps.PageWidth - ps.LeftMargin - ps.RightMargin : ps.PageWidth;
double freePageHeight = image.IsInline ? ps.PageHeight - ps.TopMargin - ps.BottomMargin : ps.PageHeight;
ImageSize size = image.ImageData.ImageSize;
Boolean exceedsMaxPageSize = size.WidthPoints > freePageWidth || size.HeightPoints > freePageHeight;
if (exceedsMaxPageSize)
{
Boolean widthLonger = (size.WidthPoints > size.HeightPoints);
double ratio = widthLonger ? freePageWidth / size.WidthPoints : freePageHeight / size.HeightPoints;
image.Width = size.WidthPoints * ratio;
image.Height = size.HeightPoints * ratio;
}
}