在表格单元格中获取HTML文本 [英] Getting HTML text with in a table cell

查看:145
本文介绍了在表格单元格中获取HTML文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 

我使用Open XML来读取单元格内的值。我可以使用innerText属性获取表格单元格内的纯文本,如下所示 -  

I am using Open XML to read the values inside the cell. I am able to get the plain text inside the cell of a table using innerText property as shown below - 

TableRow row = table.Elements< TableRow>()。ElementAt(0);

DocumentFormat.OpenXml.Wordprocessing.TableCell cell = row.Elements< DocumentFormat.OpenXml.Wordprocessing .TableCell>()。ElementAt(1);
$


  String value = cell.InnerText;

TableRow row = table.Elements<TableRow>().ElementAt(0);
DocumentFormat.OpenXml.Wordprocessing.TableCell cell = row.Elements<DocumentFormat.OpenXml.Wordprocessing.TableCell>().ElementAt(1);

 String value = cell.InnerText;

我想知道如何使用open xml api在单元格内直接获取富文本。

I would like to know how can I get directly rich text inside the cell using the open xml api.

谢谢

Prashant

prashant

推荐答案

嗨phkadse,

Hi phkadse,

据我所知,没有API /方法将单元格的值作为html获取。我们需要自己做。

As far as I know, there isn’t the API/Method to get the cell’s value as html. We need do it by ourself.

我们需要获得 ParagraphProperties RunProperties ,然后获取详细信息属性,例如
颜色

We need to get ParagraphProperties and RunProperties, then get the detail properties, such as Color.

有一个链接可能对您有所帮助:

There is a link that may benefit you:

#Html to OpenXml

https://html2openxml.codeplex.com/documentation

最好的问候

Starain


这篇关于在表格单元格中获取HTML文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆