Edraw Office Viewer Component V6.0 Released

Office Viewer Component

Edraw Office Viewer Component Acts as an ActiveX document container for embeding Office documents (including Microsoft Word, Microsoft Excel, Microsoft PowerPoint, Microsoft Project, and Microsoft Visio documents) in a custom form or Web page. The control is lightweight and flexible, and gives developers new possibilities for using Office in a custom solution.

Download link: http://www.ocxt.com/download/OfficeOCXSetup.exe

Online Demo: http://www.ocxt.com/online-demo

Free download Office Viewer Component Purchase Office Viewer Component in a promotional price

You can find the sample projects and help document in the install folder. Learn More

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 cannot to create in IE protection mode.
  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 7/ IE 8.
  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.

Edraw PDF Viewer Component V3.2 Released

PDF Viewer Component

PDF Viewer Component is a light weight ActiveX Control which enables your application to display and interact with PDF files. It is identical to Adobe Reader program and adds high speed viewing of PDF documents to your applications easily. Read-Only Support for PDF Viewer! It is a great solution for companies wishing to display read only PDF document to their employees while restricting save or save to the underlying data. The control is lightweight and flexible, and gives developers new possibilities for using PDF Reader in a custom solution.

Free download PDF Viewer Component                   Purchase PDF Viewer Component in a promotional price

Online Demo: PDF Viewer Component Online Demo
Download Printable Develop Manual

PDF Viewer Component Features

  1. Seamlessly use the Adobe Reader as the container to render the PDF files. 100% PDF format compatible.
  2. HTTP/HTTPS Support. With the component it is easy to upload or download file between distant server and client via HTTP/FTP.
  3. Show/Hide the Save Copy As button which is available in adobe tool bar.
  4. Show/Hide the PDF Print button in adobe tool bar.
  5. Show/Hide the scrollbar in PDF viewer.
  6. Disable the right-click menu in adobe reader window.
  7. Disable all the hot keys such as Save As, Print, Show/Hide Tool Bar and more.
  8. The document control represents the PDF document and lets you open, close, save, print and
    navigate the PDF document programmatically. Support all the interfaces of Adobe PDF Reader such as zoom, search and navigate.
  9. A standard ActiveX control which can be called from different programming languages, including C/C++, C#, Delphi, Visual Basic, ASP.NET etc.
  10. Requires any edition of Adobe PDF Reader is included as part of the comprehensive PDF Viewer Component. 

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.

How to insert HTML table into Word doc using Javascript?

Use Edraw Office Viewer Component to get the Document interface, then you can do it by the office automation.

document.OA1.CreateNew(”Word.Document”);
var objWord = document.OA1.ActiveDocument;
var range = objWord.Range(0,0);
var WTable = objWord.Tables.Add(range, 3,3);
WTable.Cell(1,1).Range.Font.Name = “Times New Roman”;
   
WTable.Cell(1,1).Range.Text = “examples 1″;    
WTable.Cell(1,2).Range.Font.Size = 18;    
WTable.Cell(1,2).Range.Bold = true;   
WTable.Cell(1,2).Range.Font.Italic = true;  
WTable.Cell(1,2).Range.Text = “examples 2″;     
WTable.Cell(2,1).Range.ParagraphFormat.Alignment = 1; // 0= Left, 1=Center, 2=Right   
WTable.Cell(2,1).Range.Font.Name = “Arial”;   
WTable.Cell(2,1).Range.Font.Size = 12;   
WTable.Cell(2,1).Range.Bold = false;   
WTable.Cell(2,1).Range.ParagraphFormat.Alignment = 2;     
WTable.Cell(3,3).Range.Font.Name = “Times New Roman”;    
WTable.Cell(3,3).Range.Font.Size = 14;    
WTable.Cell(3,3).Range.Bold = true;    
WTable.Cell(3,3).Range.Font.Underline = true;  
WTable.Cell(3,3).Range.ParagraphFormat.Alignment = 0;  
WTable.Cell(3,2).Range.Text = “examples 3″

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.

 

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 ….

How to verify whether the open document was modified

If you are developing the destop application with the office viewer component, you can use the “IsDirty” method to verify whether the open document is modified. When the open file has any modification, the IsDirty method return TRUE. After you save the document, the IsDirty return False again.

But if you are developing the web application, you need to add some extra codes. Because you are opening a file from remote server and the component can’t watch the file like destop application.

A good method is set another variable in your application. When you save the document, you set the variable true. Any time you can judge the dirty by the IsDirty method and your own variable.

BOOL GetIsDirty(){
if(OA.IsDirty()==Flase) return False;
else return m_bDirty;
}
event OnDocumentOpened()
{
m_bDirty = false;
}
function UploadFile()
{
……
m_bDirty = False;
}

Open Excel From File Stream Using .NET

After installed the latest demo version,  you can open the excel from file stream using the following code:

objExcel.HttpInit();

objExcel.HttpAddPostFile(”",”Evaluation.xlsx”);

objExcel.HttpOpenFileFromStream(”Evaluation/EvaluationReceiver.aspx”);

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.
m_OAHttp.AddPostArgument(L”EDA_GETSTREAMDATA”, L”EDA_YES”); 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!”);
  Response.Write(”EDA_STREAMBOUNDARY”);
  Response.BinaryWrite(fs);
  Response.Write(”EDA_STREAMBOUNDARY”);
}