OpenXML: Auto Size column width in Excel
问题 I have written a code to generate Excel file using OpenXML. Below is the code which generates the Columns in the Excel. Worksheet worksheet = new Worksheet(); Columns columns = new Columns(); int numCols = dt1.Columns.Count; for (int col = 0; col < numCols; col++) { Column c = CreateColumnData((UInt32)col + 1, (UInt32)numCols + 1, 20.42578125D); columns.Append(c); } worksheet.Append(columns); Also, I tried below line to create columns. Column c = new Column { Min = (UInt32Value)1U, Max =