Aspose.Cells单元格转换为数字格式

Aspose.Cells单元格转换为数字格式

需要在两个地方设置

           //Adding a numeric value to "A2" cell
            string a = "100";
            worksheet.Cells["A2"].PutValue(a, true);   --①主要是这个,增加一个参数,一般不会用到

            //Getting the Style of the A2 Cell
            style = worksheet.Cells["A2"].GetStyle();

            //Setting the display format to number 9 to show value as percentage
            style.Number = 1;   -- ②这个Number设置 官方有API可以看到 相应的设置

            //Applying the style to the A2 cell
            worksheet.Cells["A2"].SetStyle(style);