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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM