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);
  

相关文章:

  • 2022-12-23
  • 2021-11-16
  • 2021-11-23
  • 2021-12-07
  • 2022-02-15
  • 2021-09-25
  • 2021-10-25
猜你喜欢
  • 2022-12-23
  • 2021-12-15
  • 2021-10-31
  • 2021-12-12
  • 2021-07-04
  • 2021-08-07
  • 2022-01-26
相关资源
相似解决方案