Hi,
is it possible to open file, edit it, and save it under the same name?
VS gives me error, saying that worksheet must be saved under the unique name :/
Pasting code from your demo that saves file under different name :
private void btnRun_Click(object sender, System.EventArgs e)
{
Workbook workbook = new Workbook();
//Load workbook from disk.
workbook.LoadFromFile(@"..\..\..\..\..\..\Data\EditSheetSample.xls");
//Initialize worksheet
Worksheet sheet = workbook.Worksheets[0];
//Writes string
sheet.Range["B1"].Text = "Hello,World!";
//Writes number
sheet.Range["B2"].NumberValue = 1234.5678;
//Writes date
sheet.Range["B3"].DateTimeValue = System.DateTime.Now;
//Writes formula
sheet.Range["B4"].Formula = "=1111*11111";
workbook.SaveToFile("Sample.xls");
ExcelDocViewer(workbook.FileName);
}
private void ExcelDocViewer( string fileName )
{
try
{
System.Diagnostics.Process.Start(fileName);
}
catch{}
}