L
Lester Mosley
I am having trouble adjusting the column width when exporting from an
ASP.net web page.
I don't really want to have a sotred formated excel page and prefer to
do it by code within the display page. (When user enters the data and
requests report to run, it brings back a new page, then the user can
clcik on a button to export to excel)
I have achieved in formatting the header to a different color, as well
as adding a header with what report they have run, or add dates if it
was a custom date range. using the lower code
Response.Write("<font size=4><center>" & "Report: " & lbl_title.Text &
" " & Now.Date & "</center></font>") ' Adds title to Excel Sheet
dg_Report.HeaderStyle.BackColor = Drawing.Color.LightSkyBlue ' Colors
header row in grid and not sheet.
dg_Report.ItemStyle.VerticalAlign = VerticalAlign.Top
However I am unable to make a column width wider at all.. is there any
suggestions?
I have tried the below code with out success: (and yes I know they are
commented out at the moment, I just copied direct from code..
'dg_Report.Columns(9).ItemStyle.Width.Pixel(450) ' -- Won't work
'dg_Report.HeaderStyle.Width.Equals(20) ' -- Won't Work
'dg_Report.Columns("Description").HeaderStyle.Width =
System.Web.UI.WebControls.Unit.Pixel(100) ' -- Won't Work
'dg_Report.Columns(0).ItemStyle.Wrap = True ' -- Won't work
'dg_Report.Columns(9).ItemStyle.Width.Pixel(90) ' --Won't work
ASP.net web page.
I don't really want to have a sotred formated excel page and prefer to
do it by code within the display page. (When user enters the data and
requests report to run, it brings back a new page, then the user can
clcik on a button to export to excel)
I have achieved in formatting the header to a different color, as well
as adding a header with what report they have run, or add dates if it
was a custom date range. using the lower code
Response.Write("<font size=4><center>" & "Report: " & lbl_title.Text &
" " & Now.Date & "</center></font>") ' Adds title to Excel Sheet
dg_Report.HeaderStyle.BackColor = Drawing.Color.LightSkyBlue ' Colors
header row in grid and not sheet.
dg_Report.ItemStyle.VerticalAlign = VerticalAlign.Top
However I am unable to make a column width wider at all.. is there any
suggestions?
I have tried the below code with out success: (and yes I know they are
commented out at the moment, I just copied direct from code..
'dg_Report.Columns(9).ItemStyle.Width.Pixel(450) ' -- Won't work
'dg_Report.HeaderStyle.Width.Equals(20) ' -- Won't Work
'dg_Report.Columns("Description").HeaderStyle.Width =
System.Web.UI.WebControls.Unit.Pixel(100) ' -- Won't Work
'dg_Report.Columns(0).ItemStyle.Wrap = True ' -- Won't work
'dg_Report.Columns(9).ItemStyle.Width.Pixel(90) ' --Won't work