如何在 MS Word 表格单元格中将部分文本设为粗体?

发布于 2024-07-25 19:15:17 字数 85 浏览 2 评论 0原文

我有一个使用 MS Word 文档的 C# 应用程序。 我有一些表格,其中单元格中的某些文本需要粗体。 有办法做到吗?

I have a C# application which uses an MS Word document. I have tables where some of the text in a cell needs to be bold. Is there a way to do it?

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

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

发布评论

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

评论(1

相思故 2024-08-01 19:15:17

我假设您正在使用 Microsoft Office Interop。

我发现的例子:
http://www.c-sharpcorner.com/Forums/ShowMessages。 aspx?ThreadID=48632 说:

using Microsoft.Office.Interop.Word;

using Microsoft.Office.Core;

Document varDoc = varWord.Documents.Add(ref varMissing, ref varMissing, ref varMissing, ref varTrueValue);

varDoc.Activate();

varDoc.ActiveWindow.ActivePane.View.SeekView = WdSeekView.wdSeekCurrentPageHeader;

varDoc.ActiveWindow.Selection.Font.Bold = 1;

同样在您的应用程序中使用它。

否则,如果您使用 HTML 表,那么一种肮脏的方法是使用

html 标签。

I assume you are using Microsoft Office Interop.

The example which I found on:
http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=48632 says:

using Microsoft.Office.Interop.Word;

using Microsoft.Office.Core;

Document varDoc = varWord.Documents.Add(ref varMissing, ref varMissing, ref varMissing, ref varTrueValue);

varDoc.Activate();

varDoc.ActiveWindow.ActivePane.View.SeekView = WdSeekView.wdSeekCurrentPageHeader;

varDoc.ActiveWindow.Selection.Font.Bold = 1;

Similarly use it in your App.

Else if you are using HTML Tables, then a dirty way is to use

html tags.

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