|
|
@ -308,7 +308,6 @@ public class NPOIHelper |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
sheet.SetColumnWidth(columnNum, columnWidth * 300); // 256 |
|
|
|
sheet.SetColumnWidth(columnNum, columnWidth * 300); // 256 |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -316,6 +315,18 @@ public class NPOIHelper |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (int rowNum = 2; rowNum <= sheet.LastRowNum; rowNum++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IRow currentRow = sheet.GetRow(rowNum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int length = 25; |
|
|
|
|
|
|
|
foreach (var item in currentRow.Cells) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (item != null) |
|
|
|
|
|
|
|
length = Encoding.UTF8.GetBytes(item.ToString()).Length > length ? Encoding.UTF8.GetBytes(item.ToString()).Length : length; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
currentRow.HeightInPoints = 35 * (length / 150 + 1); |
|
|
|
|
|
|
|
} |
|
|
|
using (MemoryStream ms = new MemoryStream()) |
|
|
|
using (MemoryStream ms = new MemoryStream()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
workbook.Write(ms); |
|
|
|
workbook.Write(ms); |
|
|
|