Microsoft Word web toolbar enable

Hi, 

We develop a web document app using DSOFRAMER.

We have a lot of issues… one of them is that in Office 2003 when our application open a word document it enable the word toolbar.

 

With your product, is posible to hide it programmatically ? 

If the customer uses Office 2007, the web office documents can open good in the web browser or directly open the Word´s program ?

 

Thanks in advance

 

 

With your product is posible to hide this toolbar programmaticaly ?

Other question, if the customer uses Office 2007, the word document opens in the web page or open Word´s program ?

Thanks in advance,

Emilio

 

Inserts a break to opened Word file programmatically

boolean InsertBreak([in] WdBreakType BreakType);
Inserts a break to opened Word file.
BreakType: The break type. WdBreakType.
typedef enum WdBreakType
{
wdPageBreak = 7,
wdColumnBreak = 8,
wdSectionBreakNextPage = 2,
wdSectionBreakContinuous = 3,
wdSectionBreakEvenPage = 4,
wdSectionBreakOddPage = 5,
wdLineBreak = 6,
wdLineBreakClearLeft = 9,
wdLineBreakClearRight = 10,
wdTextWrappingBreak = 11,
}WdBreakType;
Example
The following java script shows how to insert a line break.
function InsertBreak_Example ()
{
Edword.InsertBreak( 6 );
}

How to disable the file command buttons

The Office Viewer Component provides the method “EnableFileCommand” to allow the developers to disable the File command in the MS office program.

If you are developing a web application, you can set the initial functions in the “NotifyCtrlReady” event.

function OA1_NotifyCtrlReady() {
document.OA1.EnableFileCommand(0) = false; //FileNew = 0
}
<SCRIPT LANGUAGE=javascript FOR=OA1 EVENT=NotifyCtrlReady>
<!–
OA1_NotifyCtrlReady();
//–>
</SCRIPT>

More File Command ENUMS:

typedef enum FileCommandType
{
FileNew = 0,
FileOpen,
FileClose,
FileSave,
FileSaveAs,
FilePrint,
FilePageSetup,
FileProperties,
FilePrintPreview
} FileCommandType;

How to upgrade the activex control in your program

After uninstall the old version and install the upgrade version, follow steps.

For HTML, PHP, ASp, JSP, ASP.NET application, you need change the version number in the Object tag.

<object classid=”clsid:6BA21C22-53A5-463F-BBE8-5CF7FFA0132B” id=”OA1″ width=”674″ height=”500″ codebase=”http://www.ocxt.com/download/officeviewer.cab#6,0,612,1“>

For VC project, you need go to the form and delete the component. Then delete the OfficeViewer1.h and OfficeViewer1.cpp file from your project. Save project then add the Edraw Office Viewer Component from the Toolbox. Then create a blank VC project based on Dialog. Add Edraw office Viewe Component to the Toolbox. Drag it to the dialog. Add variable for the component. You can find the OfficeViewer1.h and OfficeViewer1.cpp file in the new project. Copy the two files to your exsit project. Add exsit items…

For VB project, you need modify these files.

In OfficeViewer.frm

Object = “{F6F03022-1646-4426-A912-1F26464E81AB}#6.0#0″; “officeviewer.ocx”

In OfficeViewer.vbp

Object={F6F03022-1646-4426-A912-1F26464E81AB}#6.0#0; officeviewer.ocx

For C# or VB.NET project, you need delete the component from your form. Then delete the AxOfficeViewer and OfficeViewer references. Then right click the Toolbox and choose item… In the popup Choose Toolbox Items dialog click the COM Component. Then click the Browse… In the Edraw Office Viewer  component install folder, choose the officeviewer.ocx. Then click OK. Drag the component to your form.

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.

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);

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;

PDF Viewer Component – Disables the Save, Print, Copy Buttons

DisableSaveToolbarButton
Function: boolean DisableSaveToolbarButton (boolean bDisable);
Description: Disables the Save button at the toolbars. The method must be call after the PDF file opened.

DisablePrintToolbarButton
Function: boolean DisablePrintToolbarButton ();
Description: Disables the Print button at the toolbars. The method must be call after the PDF file opened.

DisableCopyToolbarButton
Function: boolean DisableCopyToolbarButton ();
Description: Disables the Copy button at the toolbars. The method must be call after the PDF file opened.

DisableSpecialToolbarButton
Function: boolean DisableSpecialToolbarButton(BSTR nameButton);
Description: Disables the special button at the toolbars. The method must be call after the PDF file opened.
Params:
nameButton: If you want to disable the special button at the toolbars, you need know the button’s name in the Adobe Reader. For examples: the Save button has a name as “SaveFileAs”. You can also use the follow values: Save, Print, CreatePDF, SendMail, Collaborate, Search, Copy.

Events in the PDF Viewer Component

PDF Viewer Component Events

1. Ready to Open Document Event
Event: HRESULT NotifyCtrlReady();
Description: Ready to open document.
When the component finished the initialization the NotifyCtrlReady event is raised. The event allows you to open a new document after the component has released all the resources are ready to open a new document.
HTML + JScript
&lt;html&gt;
&lt;script language=javascript id=clientEventHandlersJS&gt;
function NotifyCtrlReadyEvent ()
{
PDFViewer1.Open “http://www.ocxt.com/demo/sample.pdf”
}
&lt;/script&gt;

&lt;body&gt;
&lt;object classid=”clsid: 44A8091F-8F01-43B7-8CF7-4BBA71E61E04 ” id=”PDFViewer1″ width=”657″ height=”452″&gt;
&lt;param name=”Toolbars” value=”0″&gt;
&lt;/object&gt;
&lt;/body&gt;

&lt;script language=”JScript” for=PDFViewer1 event=” NotifyCtrlReady ()”&gt;
NotifyCtrlReadyEvent ();
&lt;/script&gt;
&lt;/html&gt;

2. Document Opened Event
Event: void OnDocumentOpened([in] BSTR FileName);
Description: Called when document is opened or new document added.
Every time a user opened a file successfully, the OnDocumentOpened event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
&lt;script language=”JScript” for=PDFViewer1 event=” OnDocumentOpened(FileName)”&gt;
OnDocumentOpenedEvent(FileName);
&lt;/script&gt;
&lt;script language=javascript&gt;
function OnDocumentOpenedEvent(FileName)
{
Alert(“Respond the Document Opened Event.”);
}
&lt;/script&gt;

3. Document Close Event
Event: void OnDocumentClosed();
Description: Called when document is closed.
Every time a user closed a file successfully, the OnDocumentClosed event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
&lt;script language=”JScript” for= PDFViewer1 event=” OnDocumentClosed()”&gt;
OnDocumentClosedEvent();
&lt;/script&gt;
&lt;script language=javascript&gt;
function OnDocumentClosedEvent()
{
Alert(“Respond the Document Close Event.”);
}
&lt;/script&gt;

4. Before Document Closed Event
Event: void BeforeDocumentClosed( [in,out] VARIANT* Cancel);
Description: Called before document is closed (may be canceled).
Every time before a user closed a document the OnActivationChange event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
&lt;script language=”JScript” for= PDFViewer1 event=” BeforeDocumentClosed (Cancel)”&gt;
OnBeforeDocumentClosedEvent(GoingActive);
&lt;/script&gt;
&lt;script language=javascript&gt;
function OnBeforeDocumentClosedEvent (GoingActive)
{
Alert(“Respond the Before Document Closed Event.”);
}
&lt;/script&gt;

5. Before Document Saved Event
Event: void BeforeDocumentSaved( [in,out] VARIANT* Cancel);
Description: Called before document is saved (may be canceled).
Every time a user opens a new document or closes a document the OnActivationChange event is raised. The event allows you to override the default behavior for the control and supply your own custom actions and dialog boxes to do normal file operations.
HTML + JScript
&lt;script language=”JScript” for= PDFViewer1 event=” BeforeDocumentSaved( Cancel)”&gt;
OnBeforeDocumentSavedEvent(GoingActive);
&lt;/script&gt;

&lt;script language=javascript&gt;
function OnBeforeDocumentSavedEvent ( Cancel)
{
Alert(“Respond the Before Document Saved Event.”);
}
&lt;/script&gt;

6. Before Right Click the Window
Event: HRESULT OnWindowBeforeRightClick();
Description: Called before right click the component. The event needs the DisableViewRightClickMenu method or DisableToolbarRightClickMenu method is called.

7. Before Double Click the Window
Event: HRESULT OnWindowBeforeDoubleClick ();
Description: Called before double click the component.

8. Before Download File
Event: HRESULT BeforeDownloadFile ();
Description: Called before downloading the file.

9. Download File Completed
Event: HRESULT DownloadFileComplete ();
Description: Called when the file was downloaded completely.

PDF Viewer Component – Disables the Hot Keys such as Save, Copy, Print.

Enable the developers to disables the Hot Keys such as Save, Copy, Print in the PDF Viewer Component.
Function: void DisableHotKeyPrint();
  void DisableHotKeySave();
  void DisableHotKeyCopy();
  void DisableHotKeyShowBookMarks();
  void DisableHotKeyShowThumnails();
  void DisableHotKeyShowToolbars();
  void DisableHotKeySearch();
Description: Disables the hotkeys at the Adobe Reader.