Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 18, 2005 06:13 PM by aditya_19792002
Member
30 Points
6 Posts
Apr 18, 2005 06:13 PM|LINK
string
string path = Server.MapPath("gen_templates/") + DateTime.Now.ToString("dd_MM_yy_hh_mm_ss");
StreamWriter sw = new StreamWriter(path + ".htm");
sw.WriteLine(txt);
sw.Close();
//generateExcel(path);
mediaLocationsFullDetail mfd = new mediaLocationsFullDetail();
string ret = mfd.Generate(path, "print", "Finland", "M");//try
path += ".htm";
Excel.Application excelApp = newApplicationClass();
Excel.Application excelApp1 = new Excel.ApplicationClass();
Excel.Workbook workbook1 = excelApp1.Workbooks.Open(path,0,false,5,"","",false,Excel.XlPlatform.xlWindows,"",true,false,0,true,false,false);
workbook1.Activate();
excelApp1.Application.Cells.Select();
//excelApp1.Application.Selection.Copy();
excelApp1.Application.Cells.Copy(
workbook.Activate();
excelApp.Sheets.Add(Type.Missing,Type.Missing,Type.Missing,Type.Missing);
excelApp.Application.Sheets[1].Select;
excelApp.Application.ActiveSheet.Paste(Type.Missing,excelApp.ActiveWorkbook.Sheets[2]);
excelApp.Application.Sheets[1].Name="Flight Template";
excelApp.Application.Sheets[2].Name="Location Data";
path = Server.MapPath("gen_templates/") + DateTime.Now.ToString("dd_MM_yy_hh_mm_ss");
path += ".xls";
excelApp.ActiveWorkbook.SaveAs(path,43,"","",false,false,Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
workbook.Close(false,Type.Missing,Type.Missing);
workbook1.Close(false,Type.Missing,Type.Missing);
excelApp1.Quit();
Iam getting error when i try to copy the data from sheet 1 to sheet and finally save the sheet1. Iam doing doing in C#... Does any body can help me?
aditya_19792...
Member
30 Points
6 Posts
copy data from sheet1 to sheet2
Apr 18, 2005 06:13 PM|LINK
string
txt = retrieveTemplate();string path = Server.MapPath("gen_templates/") + DateTime.Now.ToString("dd_MM_yy_hh_mm_ss");
StreamWriter sw = new StreamWriter(path + ".htm");
sw.WriteLine(txt);
sw.Close();
//generateExcel(path);
mediaLocationsFullDetail mfd = new mediaLocationsFullDetail();
string ret = mfd.Generate(path, "print", "Finland", "M");//try
path += ".htm";
Excel.Application excelApp = newApplicationClass();
Excel.Application excelApp1 = new Excel.ApplicationClass();
Excel.Workbook workbook1 = excelApp1.Workbooks.Open(path,0,false,5,"","",false,Excel.XlPlatform.xlWindows,"",true,false,0,true,false,false);
workbook1.Activate();
excelApp1.Application.Cells.Select();
//excelApp1.Application.Selection.Copy();
excelApp1.Application.Cells.Copy(
workbook.Activate();
excelApp.Sheets.Add(Type.Missing,Type.Missing,Type.Missing,Type.Missing);
excelApp.Application.Sheets[1].Select;
excelApp.Application.ActiveSheet.Paste(Type.Missing,excelApp.ActiveWorkbook.Sheets[2]);
excelApp.Application.Sheets[1].Name="Flight Template";
excelApp.Application.Sheets[2].Name="Location Data";
path = Server.MapPath("gen_templates/") + DateTime.Now.ToString("dd_MM_yy_hh_mm_ss");
path += ".xls";
excelApp.ActiveWorkbook.SaveAs(path,43,"","",false,false,Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
workbook.Close(false,Type.Missing,Type.Missing);
workbook1.Close(false,Type.Missing,Type.Missing);
excelApp1.Quit();
Iam getting error when i try to copy the data from sheet 1 to sheet and finally save the sheet1. Iam doing doing in C#... Does any body can help me?