Hide the office 2013 ribbon file menu

The new version can hide the file menu items for the ms office 2013 with the following settings.

function OA1_BeforeDocumentOpened()
document.OA1.DisableFileCommand(1, true);//wdUIDisalbeOfficeButton
document.OA1.DisableFileCommand(2, true);//wdUIDisalbeNew
document.OA1.DisableFileCommand(4, true);//wdUIDisalbeOpen

More options:

wdUIDisableOfficeButton   =    0x00000001,
wdUIDisableNew   =    0x00000002,
wdUIDisableOpen    =    0x00000004,
wdUIDisableUpgradeDocument     =    0x00000008,
wdUIDisableSave   =    0x00000010,
wdUIDisableSaveAs  =    0x00000020,
wdUIDisableSendAsAttachment   =    0x00000040,
wdUIDisableClose   =    0x00000100,
wdUIDisablePrint   =    0x00000200,
wdUIDisablePrintQuick   =    0x00000400,
wdUIDisablePrintPreview   =    0x00000800,
wdUIDisableSaveAsMenu   =    0x00001000,
wdUIDisablePrepareMenu   =    0x00002000,
wdUIDisablePermissionRestrictMenu   =    0x00004000,
wdUIDisableSendMenu    =    0x00008000,
wdUIDisablePublishMenu    =    0x00010000,
wdUIDisableServerTasksMenu   =    0x00020000,
wdUIDisableCopyButton   =    0x00040000,
wdUIDisableCutButton   =    0x00080000,

View RTF formatted string in the office viewer component

Tthis office viewer component could retrieve and save the physical files form the server when we provide the respective file paths.  This component also support to load/save the content of the documents through RTF formatted strings. These strings will be saved and retrieved as it is from the database. The developers can write javascript functions within JSPs to provide access to javascript variables to take these RTF formatted string values.

Firstly, the component can open a rtf file from server with the stream mode.

Referent the following page to write a asp.net page in your server to read file to stream.


Then use the following javascript to load the file into component.

<script language=”vbscript”>
Sub DownloadFile()
EDOffice.HttpAddpostString(“DocumentID”, “name.rtf”);
EDOffice.HttpOpenFileFromStream(“http://localhost:2440/ASPCSharp/UploadAction.aspx”, “Word.Application”);
End Sub

To save rtf file back to server, you need call the following method.


<script language=”vbscript”>
Sub UploadFile()
EDOffice.HttpAddpostString “author”, “anyname”
EDOffice.HttpAddpostString “Data”, “2010-5-15”
EDOffice.HttpAddPostOpenedFile filename.rtf,  6                 ;wdFormatRTF = 6,
EDOffice.HttpPost “http://localhost:1320/Samples/UploadAction.aspx”
End Sub
< /script>

WordInsertPicture Method for a Server Path

We are trying to in insert an image in the word document programatically  and we are using WordInsertPicture
method.We are getting an error message which says the  \’\’The graphics filter was unable to convert this file \” .We
are getting this error specifically in the server instance and not in the local instance.Please suggest the proper
method if any.


The WordInsertPicutre method supports local path. You need download the image to your local client. Then use the method.

How to restore the disabled button in MS Word

Sometimes in Microsoft Word or Outlook the default template file normal.dot can become corrupt.

To restore it do the following:

1. Close all office applications including Word and Outlook.

2. Use the normal.dot in the attachment.

3. Save it to your desktop to normal.dot.

4. Copy it to

C:\Documents and Settings\<youraccount>\Application Data\Microsoft\Templates

5. Replace the file that is already in that folder.

When you then open Word or go to create a new message in Outlook 2003 the problem should be fixed.

Open password protected word and excel file programmatically

The Edraw Excel Viewer Component and Word Viewer Component support to ppen password protected word and excel file programmatically. You need call the SetValue method to set the password and writepassword before you call the Open method.

boolean SetValue([in] BSTR Name, [in] BSTR Value);
Sets the pasword, writepassword, domain and protectmodereminder
for the document.
Name: The name string.
Value: The value string.
The following vb script shows how to open a password-protected document. if the 1.docx file
has the password 1234, the writepassword 5678, you can use the follow sample.
Sub SetValue_Example()
edword.SetValue “Password”, “1234”
edword.SetValue “WritePassword”, “5678”
edword.Open “c:\1.docx”
End Sub

How To Import Edraw Office Viewer ActiveX Control in Delphi

Edraw Office Viewer Component can display and interact office document in the delphi program. Here is how to import Edraw Office Viewer ActiveX Control in Delphi.
1. Start Delphi and select Component | Import ActiveX Control… (recommend Delphi 2007/2009)

2. Look for the Edraw Office Viewer Component you wish to import (dialog displays the ActiveX controls registered on your system).

3. Select the Component palette location in which you want to place selected library.

4. Maybe the best is to leave the ActiveX option selected.

5. Click on Install.

6. Select a package where the new component must be installed or

7. Create a new package for the new TSomeActiveX control.

8. Click on OK.

9. Delphi will prompt you whether you want to rebuild the modified/new package or not.

10. Click on Yes.

11. After the package is compiled, Delphi will show you a message saying that the new Office Viewer Component was registered and already available as part of the VCL.

12. Close the package detail window, allowing Delphi to save the changes to it.

13. The component is now available in the ActiveX tab (if you didn’t change this setting in step 4)

14. Drop the component on a form, and simply: use it.

1. In step 3, selecting the component palette for new Edraw Office Viewer Component allows you to group controls by function or vendor, for example.
2. The component wrapper is linked into the application executable file (or a runtime package), but the .OCX file for the component also needs to be deployed with the application.
3. ActiveX controls need to be registered on the deployment computer before use. Installation programs such as InstallShield Express automate this registration process.

Clear the ActiveX CAB file from IE Cache

For IE7 or IE8, you can delete the IE Addon with the follow method:
1. Open a new Internet Explore.
2. Go to Internet Explorer, and click the “Tools” button in the left of browser, and then click Manage Add-ons. 
3. Click Toolbars and Extensions 
4. Double Click the add-on you want to delete. In the pop up message box, you can click the Delete button in the bottom.
For IE6, you can delete the IE Addon with the follow method:
IE Toolbar > Options > General > Setting > View Object… 

Then delete the Edraw Viewer Component for Word.

Office Component System Requirements

Edraw compnent system requirements

Hardware :
Pentium Based MMX processor 500 MHZ
256 MB of ram
SVGA Graphics card
64 MB HardDisk
Intel Celeron or AMD Duron 1 GHz and above
1 GB ram
SVGA Graphics card with some acceleration (1024x768x16bitsColor)
Software :
Windows 2000 with IE6 and above.
IE 6/7/8
Windows 2000/XP/2003/Vista/Windows 7
Office 2000/XP/2003/2007/2010
For web application: The component need IE Protection Mode was Turn Off.
You can added your site at the IE trusted site list to turn off the IE protection mode
automatically when the users visit your site with the component.
Please consider also your application’s requirements.

Open a Stream from Server without temporary file

In Office Viewer new version, you can use OpenFileFromStream to open a appointed file or open a file in database.

Either you want to open an appointed file or open a file from database, for client side, all what you need do is the
same, like following:

m_oEdrawOfficeViewer.HttpAddpostString(L”DocumentID”, L”Tester.doc”);

Before you call function HttpOpenFileFromStream, you should do two things, one is to initialize http for clearing all parameters and cookies in http, another thing is to appoint the file or database record. And then use HttpOpenFileFromStream to send the request to the destinated webpage.
Before HttpOpenFileFromStream send request, it will add a couple of parameters automatically.
This couple of parameters tell the destinated webpage OfficeViewer will received file as stream.

At the web side, webpage will decide to read which file or database reacord accordding to the post parameters.
And you should add boundary flag ‘EDA_STREAMBOUNDARY’ to file data, following is the asp.net demo.

if (Request.Params[“EDA_GETSTREAMDATA”] == “EDA_YES”)
  String fullFileName = Server.MapPath(Request.Params[“DocumentID”]);
  Byte[] fs = File.ReadAllBytes(fullFileName);

  Response.Write(“Get Stream Successfully!”);

How to Save the opened file to server?

Yes, EDraw Web Office Component provides a “save” method to save the opened file to a web server or local hard disk.

[id(27), helpstring(“Saves the document to specified location or its original location.”)]
boolean Save([in, optional] VARIANT SaveAsDocument, [in, optional] VARIANT WebUsername, [in, optional] VARIANT WebPassword);  

For example:


OA1.Save “c:\temp.doc”

OA1.Save “http://www.ocxt.com/demo/upload.aspx“, “username”, “password”