The bookmark methods in the Word component

long GetBookmarkCount();
Returns the number of bookmarks.
BSTR ReadBookmarkInfo([in] long Pos, [in] boolean
NameOrValue);
Returns the name or value of the special bookmark.
Pos: The index of bookmarks in the document. From 1 to …
NameOrValue: True returns the bookmark name, False returns the bookmark value.
Example
The following java script shows how to read the bookmark information.
function Readbookmark_Example ()
{
Var count = edword.GetBookmarkCount();
For(int i=1; i<=count; i++)
{
Var name = edword.GetBookmarkInfo(i, true);
Var value = edword.GetBookmarkInfo(i, false);
}
boolean WriteBookmarkInfo([in] BSTR Name, [in] BSTR
Value);
Writes the value for the special bookmark.
Name: The bookmark name.
Value: The bookmark value.

ActiveX controls running in the IE process cannot install updates themselves

When IE is in Protected Mode on Windows Vista, ActiveX controls running in the IE process cannot install updates themselves. This is because IE and ActiveX controls do not have write access to most locations in the file system or registry under Protected Mode. As a result, it’s best to use a separate executable to download and install the update. You can further protect users against “man-in-the-middle” attacks by using an SSL connection to download updates. For more information on Protected Mode see the technical article Understanding and Working in Protected Mode.

Similar to the initial install process, your executable will need administrative privileges to install updates for all users on the machine.  To request administrative privileges on Windows Vista, create an application manifest for your executable with the following requested execution level:

<requestedExecutionLevel
level=”requireAdministrator”/>

Note that Windows Vista will see the requested execution level and display a User Account Control (UAC) dialog so the user can elevate the update executable out of Protected Mode.

How to start MS Office Automation for my Web Application

How to start MS Office Automation for my Web Application?
How to call Office Automation methods from JavaScript code?
What are the input and the output parameters type for the Office Automation methods?

View the follow samples:

function WordAutomation()
{
document.OA1.CreateNew( “Word.Document”);
var objWord = document.OA1.ActiveDocument;
objWord.Content.Text = “You can do the office Automation with the Edraw Office Viewer Component.”;

 
more examples:

Use the follow Javascript to insert a file in the header of MS Word.
function WordAutomation()
{
document.OA1.CreateNew(”Word.Document”);
var objWord = document.OA1.ActiveDocument;
objWord.Sections(1).Headers(1).Range.InsertFile(”c:\\test.docx”);
}

Pass optional parameters when you call a function in Visual C++

When you call a method that has optional parameters from Visual C++, you cannot omit the optional parameters. You need to pass a special VARIANT instead.

Some methods have “optional” parameters. In Visual Basic, you can omit them when calling the method. However, when calling with Visual C++, you have to pass a special VARIANT whose .vt field has the value VT_ERROR and .scode field has the value DISP_E_PARAMNOTFOUND. That is:

VARIANT varOpt;
varOpt.vt = VT_ERROR;
varOpt.scode = DISP_E_PARAMNOTFOUND;
OfficeViewer1.OfficeProtectDocument(varOpt);

Print MS Word Document to the special printer

When you use the PrintOut method to print the word document with the  component, you maybe get the follow error.

This error can appear if a default printer has not been designated or if the application is unable to locate an existing default printer. To correct this problem, try one of the following in Microsoft Windows:
If a printer is not available in the Print dialog box, add a printer.
If the application cannot find an existing printer that is already installed, set the printer as the default printer.
If a default printer is installed but the application is unable to use it, uninstall the printer driver, and then install the latest version of the printer driver.
If the printer is on a print server, make sure the printer is available, the network is functioning, the server is not stalled, the printer is not out of paper, or the printer is not suspended by the administrator. Printing issues associated with a network printer are best handled by your local network administrator.
For more information about setting up and troubleshooting printer connections, see Windows Help and Support. (Click the Start button, and then click Help and Support.)

Word cannot print. There is no printer installed.

There are some solutions for it.

1. Call the ShowDialog 4 to use the default printer.

2. Word:
    CWordApplication app(m_wnd.get_Application()); 
    CString strOldPrinter = app.get_ActivePrinter();
    app.put_ActivePrinter(strPrinter); 
    app.PrintOut(varFalse, varOptional, varOptional, varOptional,
        varOptional, varOptional, varOptional, varOptional, varOptional,
        varOptional, varOptional, varOptional, varOptional, varOptional,
        varOptional, varOptional, varOptional, varOptional, varOptional); 
    app.put_ActivePrinter(strOldPrinter);

Hide the Office ActiveX Control in Runtime

If you would like to hide the EDraw Office Viewer ActiveX Control in runtime, you need call the “OfficeObjectVisable” method.

For example: axOfficeViewer1.OfficeObjectVisable = false;

The follow code will lead to an error in C#.

axOfficeViewer1.Dock = System.Windows.Forms.DockStyle.Fill;
axOfficeViewer2.Visible = false;
axOfficeViewer3.Visible = false;