views:

13

answers:

0

Hi there

I am trying to generate a report in excel format, I already have the PDF version working nicely but the component that i use for that helpfully deals with page breaks all by itself.

the report data is grouped by location, so as each location in the underlying datatable changes, i need to throw a page break and re-render the headings (with the new location) - but more difficultly , i need to handle the possibility of the same location spanning more than one page.. ie. keeping the headers the same , throwing a page continuing the table - with headings again.

as it stands i am building up a fresh datatable for each location grouping - as the underlying data coming back from the DB needed transposing..

//make a dt with all the right cols
DataTable dt = getDTforreport(...);
DataRow dr = null;
foreach(linqObj row in data){
  location = row.location;
  if(location != currentlocation){
    //throw page redo headers <- how to do this in excel.. 
  }else{
    dr = dt.NewRow();
    dr["fldname"] = row.name;
    dr["fldname2"] = row.somethingelse;
    //..etc
  }
  currentlocation = location;
}
//last - throw page redo headers

quite possibly this is very unclear, for the pdf component i could bung the DataTable at it, and it happily dealt with the table headers and if the data made the table span more than one page, it would output the column headings again all on its own.. i just have no idea how to handle this in excel

would be nice if i could just bung the datatable at some excel component and it would deal with all that.. heres hoping...

thanks

nat