C# Aspose Word Table:如何向单元格文本添加上划线样式

发布于 2025-01-16 21:34:46 字数 238 浏览 3 评论 0原文

我是 Aspose.Words for .Net 特别是表格的新手,正在为客户重新创建一些文档,并且我想动态创建一个具有严重行和列的表格, 我的问题是如何使样式在单元格中的文本上划线(如下图:例如:黄色单元格)? 在此处输入图像描述

我在文档中搜索了太多,但我只找到了 pdf 的样式,我需要它用于 Aspose Word !任何人都可以帮助我吗!

I'm new to Aspose.Words for .Net specifically Tables, and working on recreating some documents for a customer , and i want to create a table with severel rows and columns dynamically,
my question is that how make the style Overline to a Text in cell (like the picture bellow : ex: cell in Yellow) ?
enter image description here

I searched too much in documentation but i found only the style for the pdf, i need it for Aspose Word ! can any one help me please !!!

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

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

发布评论

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

评论(1

层林尽染 2025-01-23 21:34:46

您可以通过设置 Paragraph 的上边框来实现此目的。例如看下面的代码:

Document doc = new Document(@"C:\Temp\in.docx");

Table table = doc.FirstSection.Body.Tables[0];
foreach (Paragraph p in table.Rows[2].Cells[3].Paragraphs)
    p.ParagraphFormat.Borders.Top.LineWidth = 1;

doc.Save(@"C:\Temp\out.docx");

You can achieve this by setting top border of the Paragraph. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");

Table table = doc.FirstSection.Body.Tables[0];
foreach (Paragraph p in table.Rows[2].Cells[3].Paragraphs)
    p.ParagraphFormat.Borders.Top.LineWidth = 1;

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