Reshma Patil

Reshma Patil

  • NA
  • 1
  • 642

Added New Line between DataGrid to export t0 MS-Word doc

May 22 2015 6:59 AM
Hello,
 I need a help. Plz help me
I am  copying data from datatable to MS-Word. It is working fine. But I am trying to add new line between two datatable. 
 
 DataSet ds = DAL_Common.DAL_GetData(getdata, param);
StreamWriter outputFile1 = new StreamWriter(strlocBankFilename, true);
HtmlTextWriter htw = new HtmlTextWriter(outputFile1);
DataGrid dg = new DataGrid();
dg.DataSource = ds.Tables[0];
dg.DataBind();
dg.RenderControl(htw);
DataGrid dg1 = new DataGrid();
DataTable dt1 = dsTotal.Tables[0];
dt1.Columns[1].ColumnName = dt1.Rows[0][1].ToString();
dt1.Rows.RemoveAt(0);
dg1.DataSource = dt1;
dg1.DataBind();
dg1.RenderControl(htw);
//Response.Output.Write(htw.NewLine);
DataGrid dg2 = new DataGrid();
DataTable dt2 = ds.Tables[1];
dt2.Columns[0].ColumnName = dt2.Rows[0][0].ToString();
dt2.Rows.RemoveAt(0);
dg2.DataSource = dt2;
dg2.DataBind();
dg2.RenderControl(htw);
string strlocReplace = "";
htw.Close();
using (StreamReader sr = new StreamReader(strlocBankFilename))
{
String line = sr.ReadToEnd();
strlocReplace += line;
}
 
Thanks.
 

Answers (1)