使用Excel对象模型在Excel中内联单元格格式

时间:2021-11-30 15:39:58

I have an excel table with inline formatting - only one word in the cell is bold, for example. When I read the cell value I get a plain text BSTR. How can I get the formatting?

我有一个带有内联格式的excel表 - 例如,单元格中只有一个单词是粗体。当我读取单元格值时,我得到一个纯文本BSTR。我怎样才能获得格式化?

I'm doing this in AX but I guess it's the same as in C# or anything else that uses the Excel Interop library.

我在AX中这样做但我猜它与C#或使用Excel Interop库的任何其他内容相同。

Thanks

谢谢

1 个解决方案

#1


1  

You want the Characters property of the cell. Referenced as
expression.Characters(Start, Length)

您需要单元格的Characters属性。引用为表达式。字符(开始,长度)

eg Range("A1").Characters(3,1).Font.Bold will tell if the third character is Bold

例如范围(“A1”)。字符(3,1).Font.Bold将判断第三个字符是否为粗体

#1


1  

You want the Characters property of the cell. Referenced as
expression.Characters(Start, Length)

您需要单元格的Characters属性。引用为表达式。字符(开始,长度)

eg Range("A1").Characters(3,1).Font.Bold will tell if the third character is Bold

例如范围(“A1”)。字符(3,1).Font.Bold将判断第三个字符是否为粗体