Posted by office viewer on May 8th, 2007
If you set the height = “100%” directly for the EDraw Office Viewer Component, then the component starts to flicker like mad.
How to avoid the office component flicker? The follow code is from Yves.
<html>
<head>
<script src=”__embedded_office_functions.js” type=”text/javascript”></script>
<script>
window.onresize = function() {
var con = document.body;
var ele = document.getElementById(‘officeApplication’);
ele.style.height = con.offsetHeight;
}
</script>
<script type=”text/javascript” for=”officeApplication” event=NotifyCtrlReady()>
//document.officeApplication.EnableFileCommand(0) = false;
</script>
</head>
<body style=”overflow:hidden;margin:0;padding:0;”>
<object name=”officeApplication” id=”officeApplication” codeBase=”__embedded_office.cab#5,3,406,1″ width=”100%” classid=”clsid:6BA21C22-53A5-463F-BBE8-5CF7FFA0132B” VIEWASTEXT>
<param name=”BorderStyle” value=”0″>
<param name=”Titlebar” value=”0″>
<param name=”Toolbars” value=”1″>
<param name=”LicenseName” value=”tqsoft”>
<param name=”LicenseKey” value=”ED99-5511-123F-AB82″>
<param name=”Menubar” value=”1″>
<param name=”ActivationPolicy” value=”0″>
<param name=”FrameHookPolicy” value=”0″>
<param name=”MenuAccelerators” value=”0″>
</object>
<script language=”JavaScript” type=”text/javascript” src=”NoIEActivate.js”></script>
</body>
</html>
Posted by office viewer on May 8th, 2007
If you are using EDraw Office Component, you can set the Read-Only property for the opened MS Word and MS Excel.
You needn’t do the office automation by yourself. Only call the “ProtectDocument” method in the component.
[id(55), helpstring(“Protects the opened file from modification for Word and Excel. Read Only.”)]
boolean ProtectDocument([in, optional] VARIANT Password);
The method will provent anybody to edit the document again. Include to copy or paste the content. It’s very helpful in the online document management system.
Posted by office viewer on May 7th, 2007
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
OA1.Save “c:\temp.doc”
OA1.Save “http://www.ocxt.com/demo/upload.aspx“, “username”, “password”
Posted by office viewer on May 7th, 2007
If you would like to upload the open Microsoft Office file in the asp code, you can use the Visual FileUpload dll by the VisualSoft Technologies Ltd.
Review the following code in the dump.asp page:
<%@ Language=VBScript %>
<%
On Error Resume Next
Dim l_oHlp, l_oRequester, l_sPath
l_sPath = “c:\service\” ‘ you need to modify this
Set l_oRequester = Server.CreateObject(“VisualSoft.FileUpload.1”)
If l_oRequester.GetFileName(“trackdata”) <> “” Then
l_oRequester.MaxFileSize = l_oRequester.GetFileSize(“trackdata”)
l_oRequester.GetFileName(“trackdata”)
l_lUploaderror = CInt(l_oRequester.SaveAnywayAs(“trackdata”, l_sPath & l_oRequester.GetFileName(“trackdata”)))
If Not l_lUploaderror = 0 Then Response.Write(“upload error:” & l_lUploaderror
End If
%>
Posted by office viewer on May 5th, 2007
An ActiveX control is essentially an OLE or Component Object Model (COM) object. It is a self-registering program or control; that is, it adds registry entries for itself automatically the first time it is run.
An ActiveX control can be as simple as a text box, as complex as an Office Viewer Component, and in some cases as complex as a small application. ActiveX controls are used as controls or dialogs for Internet Web sites, as add-ins to major applications from third-party vendors, and as plug-in utilities. Therefore, ActiveX is synonymous with Java, Netscape plug-ins, and scripting. However, the advantage of ActiveX over these other programming options is that ActiveX controls can also be used in applications written in different programming languages, including all of the Microsoft programming and database languages.
ActiveX controls are not stand-alone solutions. They can only be run from within host applications, such as Internet Explorer, a Microsoft Visual Basic® application, Visual C++® development system, Visual Basic, Delphi, DotNet for Applications, and so on. ActiveX controls facilitate the distribution of specialized controls over networks and the integration of those controls within Web browsers. This includes the ability of the control to identify itself to applications that use ActiveX controls.
ActiveX controls can be scripted from Web pages. This means you can use an ActiveX control to provide a control for a user interface or graphics device interface element. Once created, you can use a scripting language such as Visual Basic Scripting Edition (VBScript) or JavaScript to use the control. Your script instructs the control how to work.
EDraw Office Viewer Component is a standard ActiveX Control. It can be intergrated into the other develop circumstance supports the ActiveX Control.
Posted by office viewer on May 4th, 2007
Question
I am using Vista Beta 2 and Web Office Component with Visual Studio 2005.
When attempting to register a COM object (e.g. Active-X component or OCX) with ‘Regsvr32’, i.e.: regsvr32 COM
it fails with a message box displaying:
DllRegisterServer in COM failed.
Return code was: 0x80070005
Where ‘COM’ is the name of the COM object file.
CAUSE
This behavior may occur if you try to register a DLL by using Regsrv32 while you are logged on using an account that does not have administrative credentials, such as an account that is a member of the standard users group. An account that does not have administrative credentials cannot write to the registry or change files in the System32 folder.
The behavior occurs because Windows XP and Windows Server 2003 use a more restrictive security scheme than earlier versions of Windows use. This scheme prevents standard users from registering DLLs.
There are some solutions as follow:
1. Login in as Administrator.
2. Set “Run as Administrator” property of regsvr32.exe
3. Turned off UAC (User Account Control) in Vista OS.
Posted by office viewer on May 3rd, 2007
Automation is a process that allows applications that are written in languages such as Visual Basic .NET or C# to programmatically control other applications. Automation to Word allows you to perform actions such as creating new documents, adding text to documents, mail merge, and formatting documents. With Word and other Microsoft Office applications, virtually all of the actions that you can perform manually through the user interface can also be performed programmatically by using automation. Word exposes this programmatic functionality through an object model. The object model is a collection of classes and methods that serve as counterparts to the logical components of Word. For example, there is an Application object, a Document object, and a Paragraph object, each of which contain the functionality of those components in Word.
You can call the interesting methods and properties that Microsoft Word provides to you to manipulate documents in Word. The best way to learn how to navigate the object models of Word, Excel, and PowerPoint is to use the Macro Recorder in these Office applications:
1. Choose Record New Macro from the Macro option on the Tools menu and execute the task you’re interested in.
2. Choose Stop Recording from the Macro option on the Tools menu.
3. Once you are done recording, choose Macros from the Macro option on the Tools menu, select the macro you recorded, then click Edit.
This takes you to the generated VBA code that accomplishes the task you recorded. Keep in mind that the recorded macro will not be the best possible code in most cases, but it provides a quick and usable example.
For example to open an existing file and append some text:
object fileName = “c:\\test.doc”;
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Word.ApplicationClass oWordApp = new Word.ApplicationClass();
EDrawOfficeViewer1.Open(ref fileName, ref missing, ref missing);
Word.ApplicationClass oWordApp = EDrawOfficeViewer1.GetApplication();
oWordApp.Selection.TypeText(“This is the text”);
oWordApp.Selection.TypeParagraph();
Posted by office viewer on May 2nd, 2007
EDraw Office Viewer Component also supports a property called Dispatch that allows you to obtain a reference to the IDispatch interface of the embedded object. From this interface you can automate the object to perform tasks, edit parts of the document, or gather information about what a user has added or removed. For example, if you have a Word document open, you can use code that resembles the following to add a line of text:
Sub OfficeAutomationDemo()
WebOffice1.CreateNew “Word.Document”
Set objWord = WebOffice1.GetActiveDocument
objWord.Content.Text = “This was added by Automation”
End Sub
Recent Comments