简体   繁体   English

如何在MS Word表单元格中使文本的一部分变为粗体?

[英]How can I make a part of text bold in an MS Word table cell?

I have a C# application which uses an MS Word document. 我有一个使用MS Word文档的C#应用​​程序。 I have tables where some of the text in a cell needs to be bold . 我有一些表格,其中单元格中的某些文本需要加粗 Is there a way to do it? 有办法吗?

I assume you are using Microsoft Office Interop. 我假设您正在使用Microsoft Office Interop。

The example which I found on: http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=48632 says: 我在以下网址找到的示例: 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;

Similarly use it in your App. 同样在您的应用程序中使用它。

Else if you are using HTML Tables, then a dirty way is to use 否则,如果您使用的是HTML表格,那么一种肮脏的方法是使用

html tags. html标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM