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

Flipkart.com

  Flipkart, founded by the Bansals in 2007 is now being headed by Kalyan Krishnamurthy since 2016. A Billion dollar firm with more than 70 m...