Hello SyncFusion.
I am new to C#.NET development and I am trying to figure out how to write data into specific sheets and cells in an workbook. This workbook does not have a specific path, instead it is opened by another method and I´d like to write data to it by another method (seperate button on the winform menu).
Is there a way to do this?
Alternatively a method during the same event click writes to the excel file once it opens. Not sure what approach is best here.
This is the code.
private void selectHeatBalanceToolStripMenuItem_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.InitialDirectory = "c:\\";
openFileDialog.Filter = "xls files (*.xls)|*.xls|xlsx files (*.xlsx)|*.xlsx";
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;
Workbook wbook;
Worksheet wsheet;
_Application excel = new _Excel.Application();
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
excel = new _Excel.Application();
wbook = excel.Workbooks.Open(openFileDialog.FileName);
excel.Visible = true;
}
}
}