I have a document that my asp.net page is creating and I need to align the text of certain columns to center. I have opened the document after manually center the columns in openXML SDK but the code that is reflected does not achieve the desired outcome.
This is how I am setting the custom widths of these columns and I would like to add to this function (method, whatevs) the capability to center the text:
private static Column CreateColumnData(UInt32 StartColumnIndex, UInt32 EndColumnIndex, double ColumnWidth)
{
Column column;
column = new Column();
column.Min = StartColumnIndex;
column.Max = EndColumnIndex;
column.Width = ColumnWidth;
column.CustomWidth = true;
//the SDK says to add this next line to center the text but it doesn't work
column.Style = (UInt32Value)6U;
return column;
}
I'm open to another way but I think that the solution has got to be very simple I just can't seem to get it. If anyone can help that would be great.
NOTE: Please keep in mind that I am using OpenXML and will not be using Microsoft.Office.Interop.Excel