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.

Get Office Version by Office Automation

Version is the property of the word::Applicatin. Not a method. So you should do it as follow:

var app = document.OA1.GetApplication();
var version = app.Version;
window.alert(version);

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

Embed Word and excel program in Visual Basic project

How to add Edraw Excel Viewer Component or Word Viewer ActiveX Control to your Visual Basic 6.0 project

1. From the Project Menu select Components…
2. Select control “EDWord ActiveX Control Module” in the controls table.
3. Click the OK Button.
4. The control will now appear in your toolbox.
5. Drag and drop the control on your form.
6. Right click the control then choose the View Code… item.
7. Add the NotifyCtrlReady event and set the library file to load.
Private Sub EDWord1_NotifyCtrlReady()
EDWord1.LicenseName = “”
EDWord1.LicenseCode = “”
End Sub
8. Run the project.

Embed MS Word in the Visual C++ Project

Embed MS Word in the Visual C++ Project

Adding the word control to a simple dialog base Application
1. Begin a new MFC AppWizard(exe) dialog base Application.
2. Open The Resources Dialogs.
3. Select the Main Dialog and right click on it.
4. From pop-up menu select “Insert ActiveX Control…”.
5. Select Edraw Viewer Component For Word from the list.
6. Add a member variable to newly created control in the dialog class.
7. This will automatically generate new cpp and .h files which including the information of
edword control.
8. Call the MFC ClassWizard to add the control event message
To resize the control according the form add a new Window Message Handler WM_SIZE and
add the following code in OnSize virtual function
if(!::IsWindow(m_edword.m_hWnd)) return;
m_edword.MoveWindow(0,0,cx,cy);
See VCEDWordDemo c++ example
Upgrade a control in VC++
You can easily upgrade a VC++ project witch is using a EDWord control of a previous version:
1. Register the new version of control using the regsvr32 utility that is located in
windows system directory.
2. From Project menu select Add to Project -> Components and Controls
3. From Components and Control Gallery dialog select the folder Registered ActiveX
Controls
4. Find and select Edraw Viewer Component For Word and click OK to all next dialogs.
5. Rebuild the project.

SavetoServer and UploadAction.aspx

I’m testing the trial version of Edraw Component for Word v.7.4 befor upgrade from my version.
Everything it’s ok except SaveToServer : I’ve tried out both streaming and none, as in the sample code, but I’ve always the same message « Saved successfully ! » but it’s not so.
I’m developing an .asp application.
I can’t debug the UploadAction.aspx page because of the post method and I don’t know witch is the problem.
What does HttpPost method do?

My code in the SavetoServer method is :

[…]
document.getElementById(“OA1”).HttpInit
document.getElementById(“OA1”).HttpAddPostOpenedFile(myFile)
document.getElementById(“OA1”).HttpPost(myUploadPage)

Where myFile is initialized with the full logical path of the file on the server (es. \\Server_name\directory1\..\document.doc)
And myUploadPage is initialized with UploadAction.aspx location (es. http://…/UploadAction.aspx)

I’ve notice that when I open a file from the server the method IsReadOnly return allways true also if is not so.
I’ve tried also to give a new name to the file when I save to the server (replacing the original name with another in myFile variable), but no trace of the new file instead I receive the message « Save successfully ! ».

I’m developing also in C# for a .NET application that use framework 4 and here I’ve a different behaviour: I get error 17 corresponding to eSC_EndRequestFailed. What about this error ? when occur ?

Thanks for your attention

Edraw Viewer with Excel COM/Excel Add-in

I have been looking at Edraw for my next up coming project. I noticed that Edraw does not detect the Excel UDF/Excel Add-in but it does detect the COM add-in can you please put me in right direction.

Is there a way to open document directly from SharePoint URL?

I would like to embed the ms office viewer component to show word, excel and powerpoint files in our project. Is there a way to open ms office document directly from SharePoint URL? Save and Retrieve vice versa.

How could asp page knows user save or edit the document.

I am using edraw viewer component for MS Word in our project. How could asp page (ASP.NET) knows user save /edit the document.

Can this be done?

Please see the link http://cpccame.com/helpdesk/officeOCXHelp.png   there is a tree control where we attach a xls file, we need to open and then display the file when the file in the tree control is clicked. As you can see the control is working as the file is opened and displayed, but after that you can not use the file nor interact with excel, the only way  is to minimize the aplication the maximize but after a click or two the officeoxc just hangs.

You can see a little poject we created so you can see what the control is doing just click on the second branch of the tree

http://cpccame.com/helpdesk/ejemploEDraw.zip

If we can do it we will buy the officeocx rightaway

thanks in advance

 

Rafael Castañeda