如何在MS Word表格单元格中使文本的一部分变为粗体? [英] How can I make a part of text bold in an MS Word table cell?
本文介绍了如何在MS Word表格单元格中使文本的一部分变为粗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用MS Word文档的C#应用程序。我有一些表格,其中一些单元格中的文本需要粗体。有没有办法做到这一点?
解决方案
我假设您使用的是Microsoft Office Interop。
我找到的例子:
http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=48632 说:
使用Microsoft.Office.Interop.Word;
使用Microsoft.Office.Core;
文档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 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?
解决方案
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.
这篇关于如何在MS Word表格单元格中使文本的一部分变为粗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文