How to go to special postion in the MS Word

Edraw Viewer Component for Word added some methods to do the office automation. The GotoItem method helps to position the cursor in MS Word document.

boolean GotoItem([in] WdGoToItem What, [in]
WdGoToDirection Which, [in, optional] VARIANT Count, [in,
optional] VARIANT Name);
Goes to the specified item in the Word document.
What: Optional Object. The kind of item to which the range or selection is moved. Can be one
of the WdGoToItem constants.
Which: Optional Object. The item to which the range or selection is moved. Can be one of the
WdGoToDirection constants.
Count: Optional Object. The number of the item in the document. The default value is 1.
Only positive values are valid. To specify an item that precedes the range or selection, use
wdGoToPrevious as the Which argument and specify a Count value.
Name: Optional Object. If the What argument is wdGoToBookmark, wdGoToComment,
wdGoToField, or wdGoToObject, this argument specifies a name.
enum WdGoToItem
{
wdGoToStart = 101,
wdGoToEnd = 102,
wdGoToBookmark = -1 ,
wdGoToComment = 6 ,
wdGoToEndnote = 5 ,
wdGoToEquation = 10 ,
wdGoToField = 7 ,
wdGoToFootnote = 4 ,
wdGoToGrammaticalError= 14 ,
wdGoToGraphic = 8 ,
wdGoToHeading= 11 ,
wdGoToLine = 3 ,
wdGoToObject = 9 ,
wdGoToPage = 1 ,
wdGoToPercent = 12 ,
wdGoToProofreadingError = 15 ,
wdGoToSection = 0 ,
wdGoToSpellingError = 13 ,
wdGoToTable = 2 ,
}WdGoToItem;
enum WdGoToDirection
{
wdGoToAbsolute = 1,
wdGoToFirst = 1,
wdGoToLast = -1 ,
wdGoToNext = 2 ,
wdGoToPrevious = 3 ,
wdGoToRelative = 2 ,
}WdGoToDirection;
Example
The following java script shows how to go to the file end.
function GoToItem_Example ()
{
Edword.GoToItem( 102, 1 );
}

Prints all or part of the specified word document with settings

Edraw Word Viewer Component has the PrintOut method which support to print all or part of the specified document with settings.

boolean PrintOut( WdPrintOutRange PrintRange, [in, optional]
VARIANT FromPage, [in, optional] VARIANT ToPage, [in,
optional] VARIANT Pages, [in, optional] VARIANT Copies);
PrintRange: Optional Object. The page range. Can be any WdPrintOutRange constant.
FromPage: Optional Object. The starting page number when Range is set to wdPrintFromTo.
ToPage: Optional Object. The ending page number when Range is set to wdPrintFromTo.
Pages: Optional Object. The page numbers and page ranges to be printed, separated by
commas. For example, “2, 6-10″ prints page 2 and pages 6 through 10.
Copies: Optional Object. The number of copies to be printed.
enum WdPrintOutRange
{
wdPrintAllDocument = 0,
wdPrintSelection = 1,
wdPrintCurrentPage = 2,
wdPrintFromTo = 3,
wdPrintRangeOfPages = 4
};
Example
The following vb script shows how to print the 3-6 page in a document.
Sub PrintOut_Example()
edword.PrintOut 3, 3, 6
End Sub

Why do I fail to download the ActiveX control on the client

The failure of loading Office Viewer ActiveX control has the following possible causes:
1. The security settings of IE on the client machine are incorrect.
Please verify the following security settings of IE to “Prompt” or “Enabled”:
a) Download signed ActiveX controls
b) Run ActiveX Controls and plug-ins
c) Script ActiveX controls marked safe for scripting
The dialog box of the security setting can be launched from menu
Tools>Internet Options. Then select the security tab.

What’s New in Edraw office Viewer Component V6

  1. Fixed the bug which Word cannot create the work file: check environment temp variables when Vista UAC enabled.
  2. Fixed the bug which MS Word will shut down IE in protection mode. It’s better for web application to add work site in IE trust site list.
  3. SiteLock enables ActiveX control developers to restrict the use of an ActiveX control to a predetermined list of domain names or security zones.
  4. Developing Safer ActiveX Controls to allow special file type to upload or download.
  5. Fixed the bug which failed to create MS Word document consecutively.
  6. Added the Error code return for the http download/upload status.
  7. Fixed the bug which the component closes the Excel document (but leaves Excel running) if I have Excel open in another window.
  8. Fixed the bug which The Excel process in background is still running and not terminated actually.
  9. Now the component can work in IE 6, IE 7 and IE 8 Protection Mode Off.
  10. Fixed the toolbar region refresh bug when resize PowerPoint object when toolbar is hide.
  11. Fixed the error message “Attempt to access invalid address”.
  12. Read-Only. Protect the end user to modify the MS Word document by Calling the OfficeProtectDocument method in the OnDocumentOpened event.
  13. The OfficeProtectDocument method can also protect multiple Excel sheets. It will protect the Excel Charts too. Supports xlNoSelection, xlNoRestrictions and xlUnlockedCells.
  14. Added some methods to support http upload/download.
  15. Provided some methods to disable the hot keys. Prevent the end users to print document, copy and paste.
  16. To avoid the unknown file type in the Windows temporary folder, the component enhanced the WebUrl parse. In the HttpOpenFileFromStream, HttpOpenFileFromServerDir and Open methods, the WebUrl parameter must include the file extend name so that the component know the file type. For example: http://www.ocxt.com/Getfile.aspx?ID=1002&FileName=guid.docx, or http://www.ocxt.com/samples/sample.xls.
  17. Added the OnBeforeDownload, OnDownloadComplete and OnUploadComplete events.
  18. You can set the protect type by setting the first character of “Password” parameter. AllowOnlyRevisions = 0: User can only add revision marks to the document. AllowOnlyComments = 1: User can only modify comments in the document. AllowOnlyFormFields = 2: User can only enter data in the form fields in the document. ReadOnly = 3: No changes are allowed to the document. Available since Microsoft Word 2003.
  19. Cancelled the count limitation to open the office document at the same time.
  20. The component is safe for initialization and safe for scripting.
  21. The activex control was signed with the digital certification.
  22. Fixed the bug which  delete the user file.
  23. Fixed the bug which MS Word crashes when closing Print Preview mode.
  24. Use the NotifyCtrlReady event to avoid IE crash when loading an office document automatically.

Kill dozens of Excel.exe processes stacking up in Task Manager

The Edraw Office Viewer Component V5.6 fixed the bug which the component closes the Excel document (but leaves Excel running) if I have Excel open in another window. Fixed the bug which The Excel process in background is still running and not terminated actually.

Add some text at the end of Word document

How to add some text at the end of document that is opened in Edraw office viewer, Kindly send me java script code so that i can enter signatures in my document. Please reply as soon as possible and send my java script Example.

Embedding ms office in C# Forms

With Edraw Office Viewer Component, it’s easy to embed the ms office program in c# froms or html pages. Only drag it to your form, you can call some method to do the office automation directly such create a Word document or initialize an Excel sheet.

1. Download Edraw Office Viewer Component then install it. Or you can register the officeviewer.ocx using regsvr32 command.
  C:\\WINNT\System32\regsvr32 OfficeVidewer.ocx
2. On successful registration you would get message dialog.
3. Add Office Viewer Active-X control on your form through customize toolbox window.
4. Drag and drop component from toolbox on your form and resize as per requirement.
5. Now add reference for “Microsoft Word Object Library 11.0″ from add reference on solution explorer. Here I am using Word 2003, so object library version is 11.0.
6. You can see all added reference on solution explorer as shown in figure. Two reference has been added for Edraw Office Viewer  Component (AxOfficeViewer and OfficeViewer) and three libraries for Office & Word (Microsoft.Office.Core and Office and Word).
7. Define a variable for word document in public section of form as
   public Word.Document oDoc;
8. Add following code for button click event
private void button1_Click(object sender, System.EventArgs e)
{
     //Remove Office Viewer Component Title Bar and create a new Word document
     axOfficeViewer1.Titlebar = false;
     axOfficeViewer1.CreateNew(“Word.Document”);
     axOfficeViewer1.Activate();
     //Invoke Word properties
     oDoc = (Word.Document)axOfficeViewer1.ActiveDocument;
     oDoc.ActiveWindow.View.Type = Word.WdViewType.wdOutlineView;
     oDoc.ActiveWindow.DisplayRulers = false;
     oDoc.ActiveWindow.DisplayScreenTips = false;
     oDoc.ActiveWindow.DisplayHorizontalScrollBar = false;
     oDoc.ActiveWindow.DisplayVerticalRuler = false;
     oDoc.ActiveWindow.DisplayVerticalScrollBar = true;
}
10. Now you can add text, format it, send mail do all functionalities.
11. You can control all word functionalities to be made available or unavailable programmatically through code with all available objects, properties & Methods of word.

 

How to add Word Component to your ASP.NET project

It’s very easy to embed the MS Word in your asp.net project.  Please follow the steps:
1. Open Visual Studio.
2. Create a new ASP.NET project.
3. Don not attempt to add the Edraw Viewer Component for Word to the
Toolbox. It is a client component. You can add it as the HTML Object.
4. Copy all files at the ASP_c#\ to the new project folder.
( UploadAction.aspx UploadAction.aspx.cs Default.aspx.cs Default.aspx
Tester.doc )
5. Then add exist items…
6. Modify the Server Port in the Default.aspx.
6. Run.

Disable Popup Menu in MS Office

You can disable or delete the context menu item in MS Word or Excel by VBA programming.

Word:

OA1.CreateNew “Word.Document”
Set objWord = OA1.ActiveDocument
objWord.Application.CommandBars(“Text”).Controls(“Cu&t”).Enabled = False
objWord.Application.CommandBars(“Text”).Controls(“&Copy”).Enabled = False
objWord.Application.CommandBars(“Text”).Controls(“&Paste”).Enabled = False
‘delete item directly
‘objWord.Application.CommandBars(“Text”).Controls(1).Delete
‘objWord.Application.CommandBars(“Text”).Controls(2).Delete ….

Excel

OA1.Open “c:\text.xls”
Set objExcel = OA1.ActiveDocument
objExcel .Application.CommandBars(“Cell”).Controls(“Cu&t”).Enabled = False
objExcel .Application.CommandBars(“Cell”).Controls(“&Copy”).Enabled = False
objExcel .Application.CommandBars(“Cell”).Controls(“&Paste”).Enabled = False
‘delete item directly
‘objExcel .Application.CommandBars(“Cell”).Controls(1).Delete
‘objExcel .Application.CommandBars(“Cell”).Controls(2).Delete ….

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.