In "ApplyFontInXlsx" example, I add two lines
Without this line "font4.Boldweight = (short)FontBoldWeight.NORMAL;", It's OK.
Stack trace :
//apply font to "Microsoft Office"
IFont font4 = workbook.CreateFont();
font4.FontHeightInPoints = 12;
font4.Boldweight = (short)FontBoldWeight.NORMAL; // first line I added
richtext.ApplyFont(0, 16, font4);
.......
cell3.SetCellValue(richtext);
sheet1.AutoSizeColumn(1); // second line I added
FileStream sw = File.Create("test.xlsx");
workbook.Write(sw);
sw.Close();
sheet1.AutoSizeColumn(1) throws NullReferenceException.Without this line "font4.Boldweight = (short)FontBoldWeight.NORMAL;", It's OK.
Stack trace :
於 NPOI.OpenXmlFormats.Spreadsheet.CT_Font.sizeOfBArray()
於 NPOI.XSSF.UserModel.XSSFRichTextString.SetRunAttributes(CT_Font ctFont, CT_RPrElt pr)
於 NPOI.XSSF.UserModel.XSSFRichTextString.ApplyFont(Int32 startIndex, Int32 endIndex, IFont font)
於 NPOI.Examples.XSSF.ApplyFontInXlsx.Program.Main(String[] args) 於 d:\VS.NET\NPOI\2.0.1\examples\xssf\ApplyFontInXlsx\Program.cs: 行 56
於 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
於 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
於 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
於 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
於 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
於 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
於 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
於 System.Threading.ThreadHelper.ThreadStart()