Aspose 单元格数字格式与处理后的数据源

发布于 2024-10-26 19:53:50 字数 420 浏览 6 评论 0原文

我是 Aspose Cells 的新手,继承了一个使用它的项目。添加了一项要求,即单元格中的数值必须是实际数字 - 它们以前是文本。

因此,我更改了调用 Cell.PutValue() 的代码中的调用,以使用采用 bool isConverted 的方法的重载版本。在该参数中传递“true”值解决了这些实例的问题。

但是,在代码的其他位置,我们使用 ExcelDesigner.SetDataSource()ExcelDesigner.Process() 将网站中的数据导出到电子表格中。通过这种方法生成的电子表格还将数字作为文本存储在单元格中。

在这种情况下,如何将文本转换为数字,就像我在 PutValue() 情况下所做的那样?

I am new to Aspose Cells, having inherited a project that uses it. A requirement was added that numeric values in cells be actual numbers - they were formerly text.

So, I changed calls in the code that called Cell.PutValue() to use the overloaded version of the method that takes the bool isConverted. Passing a value of "true" in that parameter solved the problem for these instances.

However, in other places in the code, we export data from our website into a spreadsheet by using ExcelDesigner.SetDataSource() and ExcelDesigner.Process(). The spreadsheets resulting from this approach also have numbers stored in cells as text.

How can I convert the text to numbers in this case, as I did with the PutValue() case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇纵 2024-11-02 19:53:50

事实证明,Aspose 使用了一种名为“

智能标记具有可选的“参数”,它们是带括号、逗号分隔的修饰符,提供进一步的处理指令。 “(数字)”指令实现了我正在寻找的结果。

It turns out that Aspose uses something called "Smart Markers", which are directives embedded into the cells of template spreadsheets that Aspose Cells uses to decide how data should be inserted into them.

Smart Markers have optional "parameters", which are parenthesized, comma-separated modifiers giving further processing instructions. The "(numeric)" directive achieved the result that I was looking for.

驱逐舰岛风号 2024-11-02 19:53:50

您也可以直接在 Aspose.Cells 中发布查询论坛,以防您需要任何进一步的帮助。因为这些论坛由我们的支持和开发团队监控。

披露:我在 Aspose 担任开发人员传播者。

You may also post a query directly in Aspose.Cells forums, in case you need any further assistance. As those forums are monitored by our support and development teams.

Disclosure: I work as developer evangelist at Aspose.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文