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

混江龙づ霸主 提交于 2020-01-23 17:46:07

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/1052664/how-can-i-make-a-part-of-text-bold-in-an-ms-word-table-cell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!