Posted 18 June 2020, 11:57 pm EST - Updated 30 September 2022, 8:07 am EST
I have a report that requires dynamic columns, and I generating the report with code. A particular sticking point is vertically aligning the columns. I would like the columns to be wider (like the bottom part of the image), giving it the sold block of color look, but when I expand the width, the text gets a bit wonky, breaking apart instead of staying in a single line (like in the top part of the image).
This is the code I am using, which I found online:
for (int i = 0; i < dt.Columns.Count; i++)
{
columnName = dt.Columns[i].ColumnName.Replace(" “,”_");
ctl = new GrapeCity.ActiveReports.SectionReportModel.TextBox();
var _with1 = ctl;
_with1.Name = columnName;
_with1.Text = dt.Columns[i].ColumnName;
_with1.Location = new PointF((0.3f * i) + 1.7f, 0.1f);
_with1.Size = new SizeF(0.3f, 1.3f);
_with1.Border.BottomStyle = GrapeCity.ActiveReports.BorderLineStyle.Solid;
_with1.VerticalText = true;
_with1.BackColor = System.Drawing.Color.Green;
_with1.ForeColor = System.Drawing.Color.White;
ar.Sections[0].Controls.Add(ctl);
}
Also, text is being split oddly. As you can see in the image:
- ““Bed Rail” becomes “Bed R ail”
“Call Light” becomes “C allLi ght”
“OR Lamp Arm” becomes “O R Lam p Arm””
Do you have suggestions on how I may fix this?
Thank you,
Scott