Posted by office viewer on February 15th, 2007
It’s easy to create a web office application with the EDraw Office Viewer Component. The component has the good support to do the VBA. You can write the Javascript or the vbscript to realize it. Follow the sample codes.
<script language=”JScript” for=WebOffice event=”OnDocumentOpened(vFileName,vObject)”>
OnDocumentOpened(vFileName,vObject); //opened document event
</script>
<script language=”JScript” for=WebOffice event=”OnDocumentClosed()”>
OnDocumentClosed(); //Closed document event
</script>
<script language=javascript>
function OnDocumentOpened(vFileName,vObject)
{…}
function Load(){
webform.OfficeViewer.Open=”<%=mFileName%>”;
}
function UnLoad(){
try{
webform.OfficeViewer.Close();
}catch(e){}
}
function LoadDocument(){
webform.OfficeViewer.OpenOfficeFileDialog();
}
function SaveDocument(){
webform.OfficeViewer.Save();
}
//Returns/sets whether toolbars should be displayed.
function WebToolBars(Visible){
try{
webform.OfficeViewer.ToolBars=Visible;
}catch(e){}
}
//Returns/sets whether a menu bar should be displayed.
function WebMenuBar(Visible){
try{
webform.OfficeViewer.MenuBar=Visible;
}catch(e){}
}
//Shows/Hides the specified toolbar.
function WebToolsVisible(ToolName,Visible){
try{
webform.OfficeViewer.ActiveDocument.CommandBars(ToolName).Visible = Visible;
}catch(e){}
}
Posted by office viewer on February 15th, 2007
If you can’t open the word document or excel workbook in your internet explore, you need check your IE setting. The simple method is to restore the IE security as Default setting.
Click on the “Tools” menu and select “Internet Options”. Click on the “Security” tab.
Click on the globe marked “Internet”. This will display a slider which, by default, is set to “Medium”. Click on the “custom” button and scroll down until you find the setting “Script ActiveX controls marked safe for scripting”. Enable this setting. Click OK as needed to save the setting.
Note: You computer needs MS office installed.
Posted by office viewer on February 14th, 2007
Downloading and running a piece of code from the Internet is a fundamentally dangerous act.
Microsoft attempted to ameliorate the problem through a standard called authenticode. This is a technology for signing files with a non-forgeable digital signature. Signing a file this way ensures that any alteration to the file is detectable, and the signer of the file can be positively identified.
To digitally sign a control, you will need to obtain a certificate from a certificate authority, which can be located by using the term “certificate authority” in a Web-based search engine. Follow the directions for signing controls from the certificate authority you decide to use.
If you do not sign and timestamp your executables and .cab files, Internet Explorer may display a warning message (which gets more threatening with each major rev of IE) to let the user know they are taking a risk if they continue with the installation. This is normally suppressed when the source is in the ‘Trusted Sites’ zone.
We provide the cab file and ocx file with the digital signature in the full verion. We allow the licensed users to sign the EDraw Office Viewer Component with your own digital signature too.
Posted by office viewer on February 12th, 2007
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.
Posted by office viewer on February 8th, 2007
Please review the follow sample code to save the open Microsoft Office file in the EDraw Office Viewer Component to the remote server with the ASP code.
SaveDoc1.asp
<%@LANGUAGE=”VBSCRIPT” CODEPAGE=”936″%>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
<title>EDraw Office Viewer Component</title>
</head>
<body>
<%readonly int enterCount = 12;
string[] requestValues = new string[3];
string newFile = Server.MapPath(”.”)+”\\Document\\” + DateTime.Now.ToFileTime().ToString() + “NewDoc.doc”;
BinaryReader br = new BinaryReader(Request.InputStream);
br.BaseStream.Seek(0,SeekOrigin.Begin);
int enterNo = 0;
int streamHeadLen = 0;
while(br.BaseStream.Position < br.BaseStream.Length) {
streamHeadLen ++;
char c = (char)br.ReadByte();
if(enterNo < enterCount){
if(c == ‘\n’){
enterNo ++;
}
}
else{
break;
}
}
br.BaseStream.Seek(0,SeekOrigin.Begin);
string strTemp = System.Text.UTF8Encoding.Default.GetString(br.ReadBytes(streamHeadLen - 1));
string str =”";
int index=0;
string[] requestStrings = {”RecordID”,”UserID”};
for(int i=0;i<requestStrings.Length;i++)
{
str = “Content-Disposition: form-data; name=\”"+requestStrings[i]+”\”\r\n\r\n”;
index = strTemp.IndexOf(str) + str.Length;
if( index != str.Length - 1)
{
for(int j=index;j<strTemp.Length;j++)
{
if(strTemp[j] != ‘\r’)
this.requestValues[i] += strTemp[j];
else
break;
}
}
}
str = “; filename=\”;
index = strTemp.IndexOf(str) + str.Length;
if( index != str.Length - 1)
{
for(int j=index;j<strTemp.Length;j++)
{
if(strTemp[j] != ‘\r’)
this.requestValues[2] += strTemp[j];
else
break;
}
}
FileStream newDoc = new FileStream(newFile,FileMode.Create,FileAccess.Write);
BinaryWriter bw = new BinaryWriter(newDoc);
bw.BaseStream.Seek(0,SeekOrigin.End);
while(br.BaseStream.Position < br.BaseStream.Length - 38)
{
bw.Write(br.ReadByte());
}
br.Close();
bw.Flush();
bw.Close();
%>
</body>
</html>
Recent Comments