C
Cyril
I am copying a template worksheet in excel many times within a foreach
loop using c#.
I then need to move to the first worksheet I copied to populate it
brfore moving onto the next sheet.
Does anyone have some code on this. I would appreciate your help on
this thanks.
Cyril
Code here:
// spool thro the tables extracting the base currency
// as we need to create a new sheet for every base
currency returned.
int _workSheetIdx = 1;
Excel.Sheets sheets = this.Worksheets;
Excel.Worksheet _wsTemplate =
(Excel.Worksheet)Sheets.get_Item(_workSheetIdx);
_wsTemplate.Name = "Template";
foreach (System.Data.DataTable dtBc in ds.Tables)
{
_wsTemplate.Copy(Type.Missing, _wsTemplate);
_workSheetIdx++;
_wsTemplate =
(Excel.Worksheet)this.Sheets[_workSheetIdx];
_wsTemplate.Name =
dtBc.Rows[0]["BaseCurrencyCode"].ToString();
PopulateCurrentWorkSheet(dtBc, _wsTemplate);
}
loop using c#.
I then need to move to the first worksheet I copied to populate it
brfore moving onto the next sheet.
Does anyone have some code on this. I would appreciate your help on
this thanks.
Cyril
Code here:
// spool thro the tables extracting the base currency
// as we need to create a new sheet for every base
currency returned.
int _workSheetIdx = 1;
Excel.Sheets sheets = this.Worksheets;
Excel.Worksheet _wsTemplate =
(Excel.Worksheet)Sheets.get_Item(_workSheetIdx);
_wsTemplate.Name = "Template";
foreach (System.Data.DataTable dtBc in ds.Tables)
{
_wsTemplate.Copy(Type.Missing, _wsTemplate);
_workSheetIdx++;
_wsTemplate =
(Excel.Worksheet)this.Sheets[_workSheetIdx];
_wsTemplate.Name =
dtBc.Rows[0]["BaseCurrencyCode"].ToString();
PopulateCurrentWorkSheet(dtBc, _wsTemplate);
}