Wednesday, March 4, 2009

Using Word Control in .NET

Download DSOFramer

Download and install dsoframer and restart Visual Studio

If dsoframer control doesn't appear in toolbox , then manually add the toolbox from Com tab.

>> Drag the conttrol to form.

  1. Displaying Ruler through coding
try
{
wordCtl.document.ActiveWindow.DisplayRulers = !(wordCtl.document.ActiveWindow.DisplayRulers);
}
catch { }

2. Displaying font Toolbox b

try
{
object novalue = System.Reflection.Missing.Value;
WinWordControl.WinWordControl.wd.Dialogs.Item(Word.WdWordDialog.wdDialogFormatFont).Show(ref novalue);

}
catch (Exception ex) { }

3. Bullets and Numbering

try
{
object novalue = System.Reflection.Missing.Value;

WinWordControl.WinWordControl.wd.Dialogs.Item(Word.WdWordDialog.wdDialogFormatBulletsAndNumbering).Show(ref novalue);

}
catch (Exception ex) { }


4. Spelling and Grammer

try
{
object novalue = System.Reflection.Missing.Value;

WinWordControl.WinWordControl.wd.Dialogs.Item(Word.WdWordDialog.wdDialogToolsOptionsSpellingAndGrammar).Show(ref novalue);

}
catch (Exception ex) { }


5. Insert Table

try
{
object novalue = System.Reflection.Missing.Value;

WinWordControl.WinWordControl.wd.Dialogs.Item(Word.WdWordDialog.wdDialogTableInsertTable).Show(ref novalue);

}
catch (Exception ex) { }

No comments: