Tuesday, August 18, 2009

Simple Excel to Tiff Conversion using Excel IFC

Hi guys, following is a simple function to convert a xls file to a tiff image. Here I have implemented using IRF generator class. This method requires a in built Macro.

public void ConvertToTifExcelIFC(string inputFile, string sheetName, string protectPswd)
{
ExcelIfc.IRFGeneratorClass exc = new ExcelIfc.IRFGeneratorClass();
try
{
int iRet = exc.RunMacro(inputFile, "PrintSheet");

System.IO.File.Move(inputFile.Replace(".xls", ""), inputFile.Replace(".xls", ".tif"));
}
catch (Exception Ex)
{
throw Ex;
}
finally
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(exc);
GC.Collect();
}
}

No comments:

Post a Comment

UPI FRAUD - BEWARE List - 1

 People, Please DO NOT send money to the following UPIs. These are the fake people. Ramrr1008-1@okaxis Sonalisona444@apl Ayadav83195@okhdfcb...