المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : creating excel workbooks from a given template in a particular folder



C# Programming
06-29-2009, 03:22 PM
Hi,

I have a template in ******** " c:\excel_temp\template1.xls". This template is a user defined template.

I have to use this template in a browsed ********. ( if user selects "d:\temp\" folder, then I have to import the template in " c:\excel_temp" to "d:\temp" folder).

I am trying this with C#. i have done somepart of it

string tempPath = @"D:\Documents and Settings\eob\Desktop\Testing";

//System.IO.Directory.CreateDirectory(@tempPath + launchName);

//check path exists
if (!System.IO.Directory.Exists(@tempPath + launchName))
{
System.IO.Directory.CreateDirectory(@tempPath + launchName);
}

System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(@tempPath + launchName);
int directoryCount = dir.GetFiles().Length;

if (directoryCount != 0)
{
FileInfo[] fileNames = dir.GetFiles(@tempPath + launchName);
}

Excel.Application excelFile = new Excel.ApplicationClass();

Now with the excelFile created above, I have to access the template and create an excel file same as the template in the above folder.


I am stuck at this point, pls guide me

Thanks
Ramm