views:

403

answers:

2

Hi all,

I have C# application which uses an MS Word document. I have tables and I need to meed make some of the text in a cell bold. Is there a way to do it? Thanks all in advance.

A: 

Hi!

Do you use Microsoft.Office.Interop (any version of Microsoft Word) or DocumentFormat.OpenXML (the new Office 2007 xml standard)?

Best Regards
Oliver Hanappi

Oliver Hanappi
A: 

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.

Ganesh R.
Hi all,Thanks for the answers. Yes i do use the word interop(11.0.0.0) and i can do write text into a table cell bold or not bold whichever i like . However my problem is part of the text will be bold and part of it not. This is which i couldnt found a solution.