We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Cells.Workbook 載入 html 檔案時,會發生 Column width must be between 0 and 255

您好,
我使用附件 cellwidth.html.zip (1019.5 KB)
的 html 載入 workbook 時,

var document = new Aspose.Cells.Workbook("cellwidth.html");

會發生以下的錯誤,
Aspose.Cells.CellsException
HResult=0x80131600
Message=Column width must be between 0 and 255
Source=Aspose.Cells
StackTrace:
於 Aspose.Cells.Cells.SetColumnWidth(Int32 column, Double width)
於 Aspose.Cells.Cells.SetColumnWidthPixel(Int32 column, Int32 pixels)
於 . ()
於 .(String , ArrayList )
於 .()
於 .()
於 .(Stream )
於 .(String , Stream , LoadOptions )
於 Aspose.Cells.Workbook.(String , LoadOptions )
於 Aspose.Cells.Workbook…ctor(String file)

是否因為 html 中的 table width 為 100%,而裡面的 td 加總超過 100% ?

@rainmaker_ho,

Please try the following sample code, it will fix your issue:
e.g
Sample code:

 HtmlLoadOptions options = new HtmlLoadOptions();
            options.CheckExcelRestriction = false;
            var document = new Aspose.Cells.Workbook("e:\\test2\\cellwidth.html", options);

Hope, this helps a bit.