typeconn.asp

conn.asp  时间:2021-04-18  阅读:()
EdrawViewerComponentforWordV7User'sGuide2004-2010EdrawSoft.
Allrightreserved.
EdrawandEdrawlogoareregisteredtrademarksofEdrawSoft.
ContentsEdrawViewerComponentforWord.
3Methods.
5Event.
31Property.
35Constants.
36SystemRequirements40RedistributeFiles.
41VisualBasicIssue.
42VisualC++Issues43WebApplicationIssue44ConverttoFullVersion46EdrawViewerComponentforWordEdrawViewerComponentforWordcontainsastandardActiveXcontrolthatactsasanActiveXdocumentcontainerforhostingMSWorddocumentsinacustomformorWebpage.
Thecontrolislightweightandflexible,andgivesdevelopersnewpossibilitiesforusingOfficeinacustomsolution.
ThecontrolisdesignedtohandlespecificissuesthatmakeusingActiveXdocumentsfromanon-top-levelhostwindowdifficult,andservesasastartingplaceforconstructingyourownembeddedobjectfilevieweroreditorasanActiveXcontrol.
Itisagreatsolutionforcompanieswishingtodisplayread-onlyWorddocumentdatatotheiremployeeswhilerestrictingmodificationstotheunderlyingdata.
YoucanalsodisplaypasswordprotectedWorddocumentswithoutsupplyingpasswordstoyourusers-keepyourconfidentialdatasafeandsecure!
WiththeWordcomponentitiseasytouploadordownloadfilebetweenserverandclientviaHTTP/FTP.
Howtoadd"EdrawViewerComponentforWord"toyourVisualBasic6.
0project1.
FromtheProjectMenuselectComponents…2.
Selectcontrol"EDWordActiveXControlModule"inthecontrolstable3.
ClicktheOKButton4.
Thecontrolwillnowappearinyourtoolbox5.
DraganddropthecontrolonyourformHowtoadd"EdrawViewerComponentforWord"toyour.
NETproject1.
Open.
NET2.
Right-clickonthetoolboxandselect"ChooseItems…"3.
SelecttheCOMComponentsTab4.
Check"EDWordControl"andclickOKButton5.
Thecontrolshouldappearinthetoolboxas"EdrawViewerComponentForWord"6.
Double-clickonthecontroltoaddtoyourform7.
Resizeandmovethecontrolontheformasdesired8.
Addabuttontotheform9.
Double-clickonthebuttontoaccesscodeeditorandentertheollowingcodewithintheClickevent:Note:Modifycodetopointtoanexistingdocumentfileonyourwebserver10.
EDWord1.
Open"http://www.
edrawsoft.
com/demo/samples/sample.
doc"11.
RuntheapplicationandclickonthebuttonForASP.
NETorPHPproject,youneedn'taddthecomponenttothetoolbar.
Viewthe"readme.
txt"fileinthe"installfolder\samples\ASP.
NET\"folderMethodsbooleanIsWordInstalled();ReturnswhethertheclientinstallstheMSWordprogram.
IDispatch*ActiveDocument();ReturnstheAutomationinterfaceofthedocumentobject.
ThemethodallowsyoutoobtainareferencetotheIDispatchinterfaceoftheembeddedobject.
Fromthisinterfaceyoucanautomatetheobjecttoperformtasks,editpartsofthedocument,orgatherinformationaboutwhatauserhasaddedorremoved.
Forexample,ifyouhaveaWorddocumentopen,youcanusecodethatresemblesthefollowingtoaddalineoftext:SubOfficeAutomationDemo()OfficeViewer1.
NewDocSetobjWord=edword.
ActiveDocumentedword.
Content.
Text="ThiswasaddedbyAutomation"EndSuborfunctionWordAutomation()//UsethefollowJavascripttoinsertafileintheheaderofMSWord.
{document.
OA1.
CreateNew("Word.
Document");varobjWord=document.
OA1.
ActiveDocument;objWord.
Sections(1).
Headers(1).
Range.
InsertFile("c:\\test.
docx");}IDispatch*GetApplication();ReturnstheAutomationinterfaceoftheapplication.
booleanNewDoc([in,optional]VARIANTTemplatePath,[in,optional]VARIANTNewTemplate);Createsanew,emptydocument.
TemplatePath:Thenameofthetemplatetobeusedforthenewdocument.
Ifthisargumentisomitted,theNormaltemplateisused.
NewTemplate:Truetoopenthedocumentasatemplate.
ThedefaultvalueisFalse.
ExampleThefollowingvbscriptshowshowtoopenwordtemplate.
SubNewDoc_Example()edword.
NewDoc"c:\test.
dot",trueEndSubbooleanOpen(BSTRFileName);Opensthespecifieddocument.
FileName:Thenameofthedocument(needsthefullpathsorurl).
ExampleThefollowingvbscriptshowshowtoopenwordfile.
SubLoadFile_Example()edword.
Open"c:\test.
docx"EndSubSubLoadURL_Example()edword.
Open"http://www.
ocxt.
com/demo/samples/sample.
doc"EndSubbooleanSave();Savesthespecifieddocument.
Ifthedocumenthasn'tbeensavedbefore,theSaveAsdialogboxpromptstheuserforafilename.
booleanSaveAs([in]BSTRFilePath,[in,optional]VARIANTFileFormat);Savesthedocumenttospecifiedlocationwiththespecifiedformat.
FilePath:Thenameforthedocument.
Ifadocumentwiththespecifiedfilenamealreadyexists,thedocumentisoverwrittenwithouttheuserbeingpromptedfirst.
FileFormat:Theformatinwhichthedocumentissaved.
CanbeanyWdSaveFormatconstant.
enumWdSaveFormat{wdFormatDocument=0,wdFormatTemplate=1,wdFormatText=2,wdFormatTextLineBreaks=3,wdFormatDOSText=4,wdFormatDOSTextLineBreaks=5,wdFormatRTF=6,wdFormatUnicodeText=7,wdFormatEncodedText=7,wdFormatHTML=8,wdFormatWebArchive=9,wdFormatFilteredHTML=10,wdFormatXML=11}WdSaveFormat;ExampleThefollowingvbscriptshowshowtosaveasaworddocument.
SubSaveAs_Example()edword.
SaveAs"c:\test.
docx"EndSubbooleanCloseDoc([in,optional]VARIANTSaveChanges);Closesthespecifieddocumentordocuments.
SaveChanges:Specifiesthesaveactionforthedocument.
CanbeoneofthefollowingWdSaveOptionsconstants:wdDoNotSaveChanges,wdPromptToSaveChanges,orwdSaveChanges.
enumWdSaveOptions{wdDoNotSaveChanges=0,wdSaveChanges=-1,wdPromptToSaveChanges=-2};booleanIsDirty();ReturnsTrue/Falseiffilehasbeenalteredorneedssave.
booleanIsOpened();ReturnsTrue/Faseiffilehasbeenopened.
booleanOpenFileDialog([in,optional]VARIANTFilter);Callsthestandardfiledialogtoopentheofficedocument.
Filter:Thefilefilterstring.
ExampleThefollowingvbscriptshowshowtoopenonlythedocxfiledialog.
SubOpenFileDialog_Example()edword.
OpenFileDialog"AllWordFiles(*.
docx;*.
docm;*.
dotx;*.
dotm;*.
doc;*.
dot;*.
rtf,*.
htm;*.
mht;*.
mhtml;*.
xml;*.
odt)|*.
docx;*.
docm;*.
dotx;*.
dotm;*.
doc;*.
dot;*.
rtf,*.
htm;*.
mht;*.
mhtml;*.
xml;*.
odt;*.
txt;*.
wps;*.
wtf|WordDocument(*.
docx)|*.
docx|Word97-2003Files(*.
doc)|*.
doc|AllFiles|*.
*||"EndSubbooleanSaveFileDialog([in,optional]VARIANTFilter);Callsthestandardfiledialogtosavetheofficedocument.
Filter:Thefilefilterstring.
booleanPageSetupDialog();Callsthepagesetupdialog.
booleanDocPropertiesDialog();Callthedocumentpropertiesdialog.
booleanPrintDialog();Callstheprintdialog.
booleanPrintOut(WdPrintOutRangePrintRange,[in,optional]VARIANTFromPage,[in,optional]VARIANTToPage,[in,optional]VARIANTPages,[in,optional]VARIANTCopies);Printsallorpartofthespecifieddocumentwithsettings.
PrintRange:OptionalObject.
Thepagerange.
CanbeanyWdPrintOutRangeconstant.
FromPage:OptionalObject.
ThestartingpagenumberwhenRangeissettowdPrintFromTo.
ToPage:OptionalObject.
TheendingpagenumberwhenRangeissettowdPrintFromTo.
Pages:OptionalObject.
Thepagenumbersandpagerangestobeprinted,separatedbycommas.
Forexample,"2,6-10"printspage2andpages6through10.
Copies:OptionalObject.
Thenumberofcopiestobeprinted.
enumWdPrintOutRange{wdPrintAllDocument=0,wdPrintSelection=1,wdPrintCurrentPage=2,wdPrintFromTo=3,wdPrintRangeOfPages=4};ExampleThefollowingvbscriptshowshowtoprintthe3-6pageinadocument.
SubPrintOut_Example()edword.
PrintOut3,3,6EndSubbooleanPrintPreview();Startsaprintpreview.
booleanPrintPreviewExit();Exitsacurrentprintpreview.
booleanSetValue([in]BSTRName,[in]BSTRValue);Setsthepasword,writepassword,domainandprotectmodereminderforthedocument.
Name:Thenamestring.
Value:Thevaluestring.
ExampleThefollowingvbscriptshowshowtoopenapassword-protecteddocument.
ifthe1.
docxfilehasthepassword1234,thewritepassword5678,youcanusethefollowsample.
SubSetValue_Example()edword.
SetValue"Password","1234"edword.
SetValue"WritePassword","5678"'edword.
SetValue"Domain","www.
edrawsoft.
com"'edword.
SetValue"ProtectModeReminder","TheActiveXControlsisnotavailableforInternetsitesundertheenhancedsecurityconfiguration.
"edword.
Open"c:\1.
docx"EndSubbooleanProtectDoc(WdProtectTypeProtectType,[in,optional]VARIANTPassword);Helpstoprotectthespecifieddocumentfromchanges.
Whenadocumentisprotected,userscanmakeonlylimitedchanges,suchasaddingannotations,makingrevisions,orcompletingaform.
ProtectType:Theprotectiontypeforthespecifieddocument.
WdProtectionType.
Password:OptionalObject.
Thepasswordrequiredtoremoveprotectionfromthespecifieddocument.
enumWdProtectType{wdAllowOnlyRevisions=0,wdAllowOnlyComments=1,wdAllowOnlyFormFields=2,wdAllowOnlyReading=3,wdNoProtection=-1,}WdProtectType;ExampleThefollowingvbscriptshowshowtoprotectadocumentforonlyrevisions.
SubProtectDoc_Example()edword.
ProtectDoc0EndSubbooleanUnProtectDoc([in,optional]VARIANTPassword);Removesprotectionfromthespecifieddocument.
Ifthedocumentisn'tprotected,thismethodgeneratesanerror.
Password:OptionalObject.
Thepasswordrequiredtoremoveprotectionfromthespecifieddocument.
ExampleThefollowingvbscriptshowshowtounprotectadocumentwithpassword832-f2322.
SubUnprotect_Example()edword.
UnProtectDoc"832-f2322"EndSubBSTRGetDocumentName();Returnsthenameofthespecifiedobject.
BSTRGetDocumentFullName();Specifiesthenameofadocument,template,orcascadingstylesheet,includingthedriveorWebpath.
booleanIsReadOnly();Determinesifchangestothedocumentcannotbesavedtotheoriginaldocument.
booleanDisableSaveHotKey(booleanDisable);DisablestheSavekeycodes.
Disalbe:DisablestheCTRL+S,SHIFT+F12,Alt+SHIFT+F2,F12booleanDisablePrintHotKey(booleanDisable);DisablesthePrintkeycodes.
Disalbe:DisablestheCTRL+P,CTRL+SHIFT+F12,CTRL+F2,ALT+CTRL+IbooleanDisableCopyHotKey(booleanDisable);DisablestheCopykeycodes.
Disalbe:DisablestheCTRL+C,CTRL+V,CTRL+X,SHIFT+DEL,SHIFT+INSERT,ALT+CTRL+V,CTRL+SHIFT+C,CTRL+INSERTbooleanDisplayHorizontalRuler([in]booleanShow);Shows/Hidesthehorizontalrulerintheofficeprogram.
booleanDisplayVerticalRuler([in]booleanShow);Shows/Hidestheverticalrulerintheofficeprogram.
booleanDisplayGridline([in]booleanShow);Shows/HIdesthegridlinesintheofficeprogram.
booleanSwitchViewType([in]WdViewTypeViewType);Switchestothedifferentviewforofficeprogram.
ViewType:Theviewtypeforthespecifieddocument.
WdViewType.
enumWdViewType{wdMasterView=5,wdNormalView=1,wdOutlineView=2,wdPrintPreview=4,wdPrintView=3,wdReadingView=7,wdWebView=6,}WdViewType;ExampleThefollowingvbscriptshowshowtoswitchtowebviewafterdocumentopened.
SubDocumentOpenedEvent()Edword.
SwitchViewType6EndSubDocumentOpenedEvent()booleanViewZoomTo([in]WdPageFitFitType,[in,optional]VARIANTZoomFactor);Zoomstothespecialzoomfactor.
FitType:Thezoommodeforthespecifieddocument.
WdPageFit.
ZoomFactor:Thezoomfactor.
enumWdPageFit{wdPageFitTextNone=0,wdPageFitFullPage=1,wdPageFitBestFit=2,wdPageFitTextFit=3,}WdPageFit;ExampleThefollowingvbscriptshowshowtozoomthedocumentto200%.
SubDocumentOpenedEvent()Edword.
ViewZoomTo-1,200'fitbestfit'Edword.
ViewZoomTo2EndSubDocumentOpenedEvent()booleanShowRevisions([in]booleanShow);Shows/Hidestherevisionsfortheofficeprogram.
booleanAcceptAllRevisions([in]booleanReceipt);Acceptsorrejectsallthetrackedchangesinadocumentorrange.
longGetBookmarkCount();Returnsthenumberofbookmarks.
BSTRReadBookmarkInfo([in]longPos,[in]booleanNameOrValue);Returnsthenameorvalueofthespecialbookmark.
Pos:Theindexofbookmarksinthedocument.
From1to…NameOrValue:Truereturnsthebookmarkname,Falsereturnsthebookmarkvalue.
ExampleThefollowingjavascriptshowshowtoreadthebookmarkinformation.
functionReadbookmark_Example(){Varcount=edword.
GetBookmarkCount();For(inti=1;iDocumentOpenedEvent()Thefollowingvbscriptshowshowtodiablethesaveasandsavebutton.
SubDocumentOpenedEvent()Edword.
DisableFileCommand16,true'wdUIDisalbeSaveEdword.
DisableFileCommand32,true'wdUIDisalbeSaveAsEndSubDocumentOpenedEvent()BSTRGetOfficeVersion();Returnstheversionnumberoftheofficeprogram.
longGetCurrentPageIndex();Returnsthecurrentpageindexintheword.
longGetPageCount();Returnsthetotalpagecountsintheword.
booleanUpdateOffice2003ToolbarButton([in]longOfficeID,[in]booleanVisible,[in]booleanEnabled);Disablesorhidestheoffice2000,2003toolbarbutton.
OfficeID:TheofficeMSOidforeverybutton.
Visible:Truetosetthecommandbuttonvisible.
Enabled:Truetoenablethecommandbutton.
ThefunctionworksonlyintheOffice2000/2003version.
Thefollowingvbscriptshowshowtohidethesaveasandsavebutton.
SubDocumentOpenedEvent()Edword.
UpdateOffice2003ToolbarButton3,false,false'savebuttonEdword.
UpdateOffice2003ToolbarButton748,false,false'saveasbuttonEndSubDocumentOpenedEvent()booleanInvisibleOffice2003Toolbar([in]BSTRToolbarName);Disablesorhidestheoffice2000,2003toolbar.
ToolbarName:Theoffice2000,2003commandbarname.
Thefollowingvbscriptshowshowtohidethestandardtoolbar,webtoolbarandformattingtoolbar.
SubDocumentOpenedEvent()Edword.
InvisibleOffice2003Toolbar"Standard"Edword.
InvisibleOffice2003Toolbar"Web"Edword.
InvisibleOffice2003Toolbar"Formatting"EndSubDocumentOpenedEvent()booleanHttpInit();InitializestheHTTPconnection.
booleanHttpAddPostString(BSTRName,BSTRValue);Addsthepostparameter.
Name:Theparametername.
Value:Theparametervalue.
booleanHttpAddPostFile(BSTRLocalFilePath,[in,optional]VARIANTNewFileName);Addsthepostfile.
LocalFilePath:Thefullfilepathneedstouploadtotheserver.
IttheparameterisNULL,thefunctionwilladdthefilewhichisopeninginthecomponent.
NewFileName:Thenewfilenamefortheuploadfile.
booleanHttpAddPostOpenedFile([in,optional]VARIANTNewFileName);Addstheopenedofficefiletopostqueue.
NewFileName:Thenewfilenamefortheuploadfile.
booleanHttpPost(BSTRWebUrl,[in,optional]VARIANTWebUsername,[in,optional]VARIANTWebPassword);SendsthespecifiedrequesttotheHTTPserver.
WebUrl:AstringcontainingtheweburlfromwhichuploadsdataviaHTTP.
WebUsername:Astringcontainingtheusername.
WebPassword:Astringcontainingtheaccesspassword.
ThefollowcodeisdemohowtouploadtheopenedfiletoserverwiththeHTTPmode.
Itcanalsopostmultiplefilesinapostrequest.
SubUploadFile()edword.
HttpInitedword.
HttpAddpostString"author","anyname"edword.
HttpAddpostString"Data","2010-5-15"edword.
HttpAddPostOpenedFileedword.
HttpPost"http://localhost:1320/Samples/UploadAction.
aspx"EndSubNote:Ifyoutrytosavetheopenedfiletoremoteserverwiththe"HTTP"methods,youneedwriteareceiptpageinyourwebserver.
BecausethecomponentuploadsthefilebyHTTPmode.
Thefollowissomesamplecode.
ASP.
NET://Default.
aspxSubSavetoServer()edword.
HttpInitedword.
HttpAddpostString"author","anyname"edword.
HttpAddpostString"Data","2010-5-15"edword.
HttpAddPostOpenedFileedword.
HttpPost"http://localhost:1320/Samples/UploadAction.
aspx"'edword.
Save"http://localhost:1320/UploadAction.
aspxauthor=name&Data=2"EndSub//UploadAction.
aspx.
csfileusingSystem;usingSystem.
Collections;usingSystem.
ComponentModel;usingSystem.
Data;usingSystem.
Drawing;usingSystem.
IO;usingSystem.
Web;usingSystem.
Web.
SessionState;usingSystem.
Web.
UI;usingSystem.
Web.
UI.
HtmlControls;usingSystem.
Xml;usingSystem.
Drawing.
Imaging;usingSystem.
Text.
RegularExpressions;publicpartialclassUploadAction:System.
Web.
UI.
Page{protectedvoidPage_Load(objectsender,EventArgse){if(Request.
QueryString["author"]=="name"&&Request.
QueryString["Data"]=="2"){Response.
Write("0\n");Response.
Write("WehavereceiptedtherightparamfromEdrawDiagramActiveXControl.
");}if(Request.
Files.
Count==0){Response.
Write("0\n");Response.
Write("Thereisn'tfiletoupload.
");Response.
End();}if(Request.
Files[0].
ContentLength==0){Response.
Write("0\n");Response.
Write("Failedtoreceiptthedata.
\n\n");Response.
End();}stringfullFileName=Server.
MapPath(Request.
Files[0].
FileName);Request.
Files[0].
SaveAs(fullFileName);Response.
Write("UploadSuccessfully.
");Response.
End();}}PHP:ASP:(reviewthefullcodeintheinstallfolder\samples\asp\)Request.
QueryString("id")thenid=Request.
QueryString("id")Endififid0thenSql="SELECT*fromdocwheredoc.
id="&idelseSql="SELECT*fromdoc"Endifrs.
OpenSql,conn,1,3foreachformNameinUploader.
filesetfile=Uploader.
file(formName)Ifid0thenIf(""=Request.
QueryString("isAip"))Thenrs("DocContent")=Uploader.
FileData(formnamers("DocID")=Uploader.
Form("DocID")rs("DocTitle")=Uploader.
Form("DocTitle")rs("DocType")=Uploader.
Form("DocType")Elsers("AipContent")=Uploader.
FileData(formname)rs("state")=2EndifElsers.
AddNewrs("DocID")=Uploader.
Form("DocID")rs("DocTitle")=Uploader.
Form("DocTitle")rs("DocContent")=Uploader.
FileData(formname)rs("Docdate")=Now()rs("DocType")=Uploader.
Form("DocType")rs("state")=1EndIfsetfile=nothingrs.
Updateexitfornextrs.
CloseSetrs=Nothingconn.
closesetconn=NothingSetUploader=Nothing%>JSP:jsp:booleanHttpOpenFileFromStream(BSTRWebUrl,[in,optional]VARIANTWebUsername,[in,optional]VARIANTWebPassword);OpensafilefromastreamwiththeHTTP/HTTPS.
WebUrl:AstringcontainingtheweburlfromwhichdownloadsdataviaHTTP.
TheWebUrlmustincludethefileextendnamesothatthecomponentknowthefiletype.
Forexample:http://www.
edrawsoft.
com/Getfile.
aspxID=1002&FileName=guid.
edxz,orhttp://www.
edrawsoft.
com/sample.
docx.
WebUsername:Astringcontainingtheusername.
WebPassword:Astringcontainingtheaccesspassword.
Example:Eitheryouwanttoopenanappointedfileoropenafilefromdatabase,forclientside,allwhatyouneeddoisthesame,likefollowing:SubDownloadFile()edword.
HttpInit();edword.
HttpAddpostString("DocumentID","Tester.
doc");edword.
HttpOpenFileFromStream(strDownloadPath,EndSubBeforeyoucallfunctionHttpOpenFileFromStream,youshoulddotwothings,oneistoinitializehttpforclearingallparametersandcookiesinhttp,anotherthingistoappointthefileordatabaserecord.
AndthenuseHttpOpenFileFromStreamtosendtherequesttothedestinatedwebpage.
BeforeHttpOpenFileFromStreamsendrequest,itwilladdacoupleofparametersautomatically.
edword.
AddPostArgument(L"EDA_GETSTREAMDATA",L"EDA_YES");Thiscoupleofparameterstellthedestinatedwebpageedwordwillreceivedfileasstream.
Atthewebside,webpagewilldecidetoreadwhichfileordatabasereacordaccorddingtothepostparameters.
Andyoushouldaddboundaryflag'EDA_STREAMBOUNDARY'tofiledata,followingistheasp.
netdemo.
if(Request.
Params["EDA_GETSTREAMDATA"]=="EDA_YES"){StringfullFileName=Server.
MapPath(Request.
Params["DocumentID"]);Byte[]fs=File.
ReadAllBytes(fullFileName);Response.
Write("GetStreamSuccessfully!
");Response.
Write("EDA_STREAMBOUNDARY");Response.
BinaryWrite(fs);Response.
Write("EDA_STREAMBOUNDARY");}asp:Ifl_bWrSreamBoundaryThenResponse.
Write"EDA_STREAMBOUNDARY"WhileNotl_stream.
EOSAndResponse.
IsClientConnectedResponse.
BinaryWrite(l_stream.
Read(l_nChunkSize))Wendl_stream.
CloseIfl_bWrSreamBoundaryThenResponse.
WriteEDA_STREAMBOUNDARY"BSTRHttpDownloadFileToTempDir(BSTRWebUrl,[in,optional]VARIANTWebUsername,[in,optional]VARIANTWebPassword);DownloadsafilefromaremoteserverthensaveittoOAtemporarydirectorywithHTTP.
WebUrl:AstringcontainingtheweburlfromwhichdownloadsdataviaHTTP.
TheWebUrlmustincludethefileextendnamesothatthecomponentknowthefiletype.
Forexample:http://www.
edrawsoft.
com/Getfile.
aspxID=1002&FileName=guid.
edxz,orhttp://www.
edrawsoft.
com/sample.
edxz.
WebUsername:Astringcontainingtheusername.
WebPassword:Astringcontainingtheaccesspassword.
ReturnValue:Localtemporaryfilepathtosavethedownloadfile.
Thecomponentprovidesthemethodtodownloadfilefromaserverthensavetoalocaldiskfile.
SupportHttpandHTTPS.
SubDownloadFile()DimsPath;sPath=edword.
HttpDownloadFileToTempDir"http://www.
edrawsoft.
com/demo/1.
doc"edword.
OpensPathEndSubNote:Youshouldmakesureyouthefileexistsinthewebsitefirstly.
AsimplemethodistoentertheWebUrlintheInternetExplore.
IfIEcandownloadthefile,thecomponentcandoittoo.
FAQ:IfyouareusingWindows2003asyourserver,youmaybeneedtoaddthemimetypestoInternetInformationServer.
booleanFtpConnect(BSTRWebUrl,[in,optional]VARIANTWebUsername,[in,optional]VARIANTWebPassword);CreatesaFTPconnect.
booleanFtpDownloadFile(BSTRRemoteFile,BSTRLocalFile);DownloadsafilefromremoteserverthensaveittolocalfilewithFTP.
RemoteFile:TheremotefilepathwhichsavestoFTPsite.
LocalFile:Thefullfilepathwhichdownloadstothelocaldisk.
booleanFtpUploadFile(BSTRLocalFile,BSTRRemoteFile,booleanOverWrite);UploadsalocaldiskfiletoremoteserverwithFTP.
LocalFilePath:Thefullfilepathneedstouploadtotheserver.
IttheparameterisNULL,thefunctionwilladdthefilewhichisopeninginthecomponent.
RemoteFile:TheremotefilepathwhichsavestoFTPsite.
OverWrite:OverwritestheexsitedfileifthesamefileexistsattheFTPserver.
booleanFtpDisConnect();ClosestheFTPConnect.
ThefollowcodeisdemohowtodownloadafiletolocaldiskwiththeFTPmode.
SubUploadFileviaFTP()edword.
FtpConnect"ftp.
edrawsoft.
com","username","password"edword.
FtpDownloadFile"ftp.
edrawsoft.
com/archieve/001.
doc","c:\temp.
doc"edword.
FtpDisConnectEndSublongGetErrorCode();Returnstheerrorcode.
BSTRGetTempFilePath([in,optional]VARIANTRefFileName);Getsatemporaryfilepath.
RefFileName:Thereferentfilename.
booleanClearTempFiles();Clearsthesetemporaryfilescreatedbythecomponent.
Thefunctionwon'tdeleteanyotherfilesoutoftemporaryEDdirectory.
voidShowRibbonTitlebar([in]VARIANT_BOOLShow);Shows/Hidesthetitlebarintheofficeribboninterface.
ForOffice2007andOffice2010,youcanhidetheRibbontitlebarwiththemethodintheBeforeDocumentOpenedevent.
voidShowMenubar([in]VARIANT_BOOLShow);Shows/Hidesthemenubarintheofficeinterface.
ForOffice2000,Xp,2003,youcanhidethemenubarwiththemethodintheBeforeDocumentOpenedevent.
Foroffice2007andhigherversion,youcanusetheDisableFileCommandmethod.
booleanSetComponentSize([in]longWidth,[in]longHeight);Resizesthewidthandheightofcomponent.
voidDisableStandardCommand([in]CommandTypeCmdType,[in]BOOLDisable);Disablesthestandardfile,save,printcommands.
Youcandisablethestandardcommandsintheoffice.
Thenwriteyourownprocessintheevent.
enumCommandType{cmdTypeSave=0x00000001,cmdTypeClose=0x00000002,cmdTypePrint=0x00000004,cmdTypeRightClick=0x00000008,cmdTypeDoubleClick=0x00000010,cmdTypeIESecurityReminder=0x00000020,}CommandType;Thefollowcodeisdemohowtodisabletheprintprocess.
functionOA_DocumentBeforePrint(){document.
OA1.
DisableStandardCommand(4,true);//cmdTypePrint=0x00000004,}OA_DocumentBeforePrint();Event[id(1),helpstring("Occursafterthecontrolhascompletedtheinitialization.
")]voidNotifyCtrlReady();ExampleThefollowingscripttohidethetoolbarandgridwhenthecomponentwasinitialized.
functionedword_NotifyCtrlReady(){document.
all.
edword.
LicenseName="";document.
all.
edword.
LicenseCode="";document.
all.
edword.
BorderStyle=1;document.
all.
edword.
Toolbars=false;}[id(2),helpstring("Calledwhenthenewdocumentiscreated.
")]voidNewDocument();[id(3),helpstring("Calledbeforedocumentisopenedornewdocumentadded.
")]voidBeforeDocumentOpened();ExampleThefollowingscripttoaddofficeUIsettingbeforeadocumentopened.
functionedword_BeforeDocumentOpened(){Edword.
DisableFileCommand1,false'wdUIDisalbeOfficeButtonEdword.
DisableFileCommand2,false'wdUIDisalbeNewEdword.
DisableFileCommand4,false'wdUIDisalbeOpenEdword.
DisableFileCommand16,true'wdUIDisalbeSaveEdword.
DisableFileCommand32,true'wdUIDisalbeSaveAs}[id(4),helpstring("Calledwhendocumentisopenedornewdocumentadded.
")]voidDocumentOpened();ExampleThefollowingscripttoaddofficeautomationafteradocumentwasopened.
functionedword_DocumentOpened(){varobjWord=document.
OA1.
ActiveDocument;document.
OA1.
GotoItem(101,0);//movetostart.
document.
OA1.
InsertBreak(6);//insertalinebreakvarrange=objWord.
Range(0,0);varWTable=objWord.
Tables.
Add(range,3,3);WTable.
Cell(1,1).
Range.
Font.
Name="TimesNewRoman";WTable.
Cell(1,1).
Range.
Text="Automation1";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="Automation2";WTable.
Cell(2,1).
Range.
ParagraphFormat.
Alignment=1;//0=Left,1=Center,2=RightWTable.
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="TimesNewRoman";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="Automation3";}[id(5),helpstring("Calledbeforedocumentisclosed(maybecanceled).
")]voidBeforeDocumentClosed();[id(6),helpstring("Calledbeforedocumentissaved(maybecanceled).
")]voidBeforeDocumentSaved();[id(7),helpstring("Calledbeforerightclickthecomponent.
")]voidWindowBeforeRightClick();Youcanaddyourownrightclickmenuhere.
[id(8),helpstring("Calledbeforedoubleclickthecomponent.
")]voidWindowBeforeDoubleClick();[id(9),helpstring("Calledbeforedoubleclickthecomponent.
")]voidWindowSelectionChange();[id(10),helpstring("Calledbeforedoubleclickthecomponent.
")]voidDocumentBeforePrint();[id(11),helpstring("Calledwhenthefilewasdownloadedcompletely.
")]voidWindowActivate();[id(12),helpstring("Calledwhenthefilewasdownloadedcompletely.
")]voidWindowDeactivate();[id(13),helpstring("Calledbeforedownloadingthefile.
")]voidBeforeDownloadFile();[id(14),helpstring("Calledwhenthefilewasdownloadedcompletely.
")]voidDownloadFileComplete();[id(15),helpstring("Calledwhenthefilewasuploadedcompletely.
")]voidUploadComplete();[id(16),helpstring("CalledwhentheIEisintheprotectionmode.
")]voidIESecurityReminder([in,out]VARIANT*Cancel);ExampleThefollowingscripttoremindertheuseraddedyoursiteintrustedsitelist.
functionedword_IESecurityReminder(){edword.
SetValue"Domain","www.
edrawsoft.
com"'oryoucancustomizethewholesentensebysettheProtectModeRemindervalue.
'edword.
SetValue"ProtectModeReminder","TheActiveXControlsisnotavailableforInternetsitesundertheprotectionmode.
Youcanaddwww.
yoursite.
comtotrustedsitelist.
"}Property[id(1)]booleanShowToolbars;Showsorhidesthetoolbars.
[id(2)]BSTRLicenseName;Setsthelicensename.
[id(3)]BSTRLicenseCode;Setsthelicensecode.
[id(4)]OLE_COLORBorderColor;Setsthebordercolorthecontrol.
[id(5)]longBorderStyle;Setstheborderstyleofthecontrol.
ConstantstypedefenumBorderStyle{BorderNone=0,BorderFlat,Border3D,Border3DThin}BorderStyle;typedefenumFileCommandType{FileNew=0,FileOpen,FileClose,FileSave,FileSaveAs,FilePrint,FilePageSetup,FileProperties,FilePrintPreview}FileCommandType;typedefenumWdSaveFormat{wdFormatDocument=0,wdFormatTemplate=1,wdFormatText=2,wdFormatTextLineBreaks=3,wdFormatDOSText=4,wdFormatDOSTextLineBreaks=5,wdFormatRTF=6,wdFormatUnicodeText=7,wdFormatEncodedText=7,wdFormatHTML=8,wdFormatWebArchive=9,wdFormatFilteredHTML=10,wdFormatXML=11}WdSaveFormat;typedefenumWdPrintOutRange{wdPrintAllDocument=0,wdPrintSelection=1,wdPrintCurrentPage=2,wdPrintFromTo=3,wdPrintRangeOfPages=4}WdPrintOutRange;typedefenumWdProtectType{wdAllowOnlyRevisions=0,wdAllowOnlyComments=1,wdAllowOnlyFormFields=2,wdAllowOnlyReading=3,wdNoProtection=-1,}WdProtectType;typedefenumWdViewType{wdMasterView=5,wdNormalView=1,wdOutlineView=2,wdPrintPreview=4,wdPrintView=3,wdReadingView=7,wdWebView=6,}WdViewType;typedefenumWdRevisionType{wdRevisionAuthor=0,wdRevisionDate=1,wdRevisionType=2,wdRevisionText=3,}WdRevisionType;typedefenumWdPasteDataType{wdPasteBitmap=4,wdPasteDeviceIndependentBitmap=5,wdPasteEnhancedMetafile=9,wdPasteHTML=10,wdPasteHyperlink=7,wdPasteMetafilePicture=3,wdPasteOLEObject=0,wdPasteRTF=1,wdPasteShape=8,wdPasteText=2,}WdPasteDataType;typedefenumWdBreakType{wdPageBreak=7,wdColumnBreak=8,wdSectionBreakNextPage=2,wdSectionBreakContinuous=3,wdSectionBreakEvenPage=4,wdSectionBreakOddPage=5,wdLineBreak=6,wdLineBreakClearLeft=9,wdLineBreakClearRight=10,wdTextWrappingBreak=11,}WdBreakType;typedefenumWdGoToItem{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;typedefenumWdGoToDirection{wdGoToAbsolute=1,wdGoToFirst=1,wdGoToLast=-1,wdGoToNext=2,wdGoToPrevious=3,wdGoToRelative=2,}WdGoToDirection;typedefenumWdPageFit{wdPageFitBestFit=2,wdPageFitFullPage=1,wdPageFitTextFit=3,wdPageFitTextNone=0,}WdPageFit;typedefenumWdInDocPos{wdInDocumentPosCursor=1,wdInDocumentPosStart=2,wdInDocumentPosEnd=3,}WdInDocPos;typedefenumCommandType{cmdTypeSave=0x00000001,cmdTypeClose=0x00000002,cmdTypePrint=0x00000004,cmdTypeRightClick=0x00000008,cmdTypeDoubleClick=0x00000010,cmdTypeIESecurityReminder=0x00000020,}CommandType;typedefenumWdUIType{wdUIDisalbeOfficeButton=0x00000001,wdUIDisalbeNew=0x00000002,wdUIDisalbeOpen=0x00000004,wdUIDisalbeUpgradeDocument=0x00000008,wdUIDisalbeSave=0x00000010,wdUIDisalbeSaveAs=0x00000020,wdUIDisalbeSendAsAttachment=0x00000040,wdUIDisalbeClose=0x00000100,wdUIDisalbePrint=0x00000200,wdUIDisalbePrintQuick=0x00000400,wdUIDisalbePrintPreview=0x00000800,wdUIDisalbeSaveAsMenu=0x00001000,wdUIDisalbePrepareMenu=0x00002000,wdUIDisalbePermissionRestrictMenu=0x00004000,wdUIDisalbeSendMenu=0x00008000,wdUIDisalbePublishMenu=0x00010000,wdUIDisalbeServerTasksMenu=0x00020000,wdUIDisalbeCopyButton=0x00040000,wdUIDisalbeCutButton=0x00080000,wdUIHideMenuHome=0x01000000,wdUIHideMenuInsert=0x02000000,wdUIHideMenuPageLayout=0x04000000,wdUIHideMenuReferences=0x08000000,wdUIHideMenuMailings=0x10000000,wdUIHideMenuReview=0x20000000,wdUIHideMenuView=0x40000000,wdUIHideMenuDeveloper=0x80000000,wdUIHideMenuAddIns=0x00100000,}WdUIType;typedefenumOAErrorCode{eSC_Ok=0,eSC_GenericError,eSC_InvalidFileType,eSC_InvalidSite,eSC_WrongDNS,eSC_CreateTempFileFailed,eSC_OpenUploadFileFailed,eSC_SaveOpenedFileFailed,eSC_NotHttpURL,eSC_ConnectFailed,eSC_RequestFailed,eSC_RequestHeaderFailed,eSC_EmptyArgument,eSC_OpenFileArgumentFailed,eSC_SendRequestFailed,eSC_WriteDataFailed,eSC_ReadDataFailed,eSC_EndRequestFailed,eSC_OpenFileFailed,eSC_InvalidReturnData,}OAErrorCode;SystemRequirementsHardware:Minimum:PentiumBasedMMXprocessor500MHZ256MBoframSVGAGraphicscard64MBHardDiskRecommended:IntelCeleronorAMDDuron1GHzandabove1GBramSVGAGraphicscardwithsomeacceleration(1024x768x16bitsColor)Software:Minimum:Windows2000withIE6andabove.
Recommended:IE6/7/8Windows2000/XP/2003/Vista/Windows7Office2000/XP/2003/2007/2010Forwebapplication:ThecomponentneedIEProtectionModewasTurnOff.
YoucanaddedyoursiteattheIEtrustedsitelisttoturnofftheIEprotectionmodeautomaticallywhentheusersvisityoursitewiththecomponent.
Pleaseconsideralsoyourapplication'srequirements.
RedistributeFilesHerearethefilesneededforinstallingEdrawViewerComponentForWord.
DLLandOCXEDWord.
ocxEDOfficeViewerX.
dllOryoucanusethecabfileintheinstallfolderforwebapplication.
edword.
cabVisualBasicIssueHowtoaddOfficeActiveXControltoyourVisualBasic6.
0project1.
FromtheProjectMenuselectComponents…2.
Selectcontrol"EDWordActiveXControlModule"inthecontrolstable.
3.
ClicktheOKButton.
4.
Thecontrolwillnowappearinyourtoolbox.
5.
Draganddropthecontrolonyourform.
6.
RightclickthecontrolthenchoosetheViewCode…item.
7.
AddtheNotifyCtrlReadyeventandsetthelibraryfiletoload.
PrivateSubEDWord1_NotifyCtrlReady()EDWord1.
LicenseName=""EDWord1.
LicenseCode=""EndSub8.
Runtheproject.
VisualC++IssuesAddingthecontroltoasimpledialogbaseApplication1.
BeginanewMFCAppWizard(exe)dialogbaseApplication.
2.
OpenTheResourcesDialogs.
3.
SelecttheMainDialogandrightclickonit.
4.
Frompop-upmenuselect"InsertActiveXControl…".
5.
SelectEdrawViewerComponentForWordfromthelist.
6.
Addamembervariabletonewlycreatedcontrolinthedialogclass.
7.
Thiswillautomaticallygeneratenewcppand.
hfileswhichincludingtheinformationofedwordcontrol.
8.
CalltheMFCClassWizardtoaddthecontroleventmessageToresizethecontrolaccordingtheformaddanewWindowMessageHandlerWM_SIZEandaddthefollowingcodeinOnSizevirtualfunctionif(!
::IsWindow(m_edword.
m_hWnd))return;m_edword.
MoveWindow(0,0,cx,cy);SeeVCEDWordDemoc++exampleUpgradeacontrolinVC++YoucaneasilyupgradeaVC++projectwitchisusingaEDWordcontrolofapreviousversion:1.
Registerthenewversionofcontrolusingtheregsvr32utilitythatislocatedinwindowssystemdirectory.
2.
FromProjectmenuselectAddtoProject->ComponentsandControls3.
FromComponentsandControlGallerydialogselectthefolderRegisteredActiveXControls4.
FindandselectEdrawViewerComponentForWordandclickOKtoallnextdialogs.
5.
Rebuildtheproject.
WebApplicationIssueUsetheedword.
cabfileThecomponentcanbeusedforwebapplication.
YoucanembeditatthehtmlObjecttag.
Note:Youshouldputtheedword.
cabfileinyourownsiteandchangethecodebaseurlwhenyoudistributethecomponent.
Youcanviewthehtmlsamplesintheinstallfolder\samples\htmlfolder.
Theedword.
cabfileisavailableintheintallfolder.
Youcancreateyourowncabfile.
WhydoIfailtodownloadtheActiveXcontrolontheclientmachineThefailureofloadingActiveXcontrolhasthefollowingpossiblecauses:1.
ThesecuritysettingsofIEontheclientmachineareincorrect.
PleaseverifythefollowingsecuritysettingsofIEto"Prompt"or"Enabled":a)DownloadsignedActiveXcontrolsb)RunActiveXControlsandplug-insc)ScriptActiveXcontrolsmarkedsafeforscriptingThedialogboxofthesecuritysettingcanbelaunchedfrommenuTools>InternetOptions.
Thenselectthesecuritytab.
HowtoaddEdrawComponenttoyourASP.
NETproject1.
OpenVisualStudio.
2.
CreateanewASP.
NETproject.
3.
DonnotattempttoaddtheEdrawViewerComponentForWordtotheToolbox.
Itisaclientcomponent.
YoucanadditastheHTMLObject.
4.
CopyallfilesattheASP_c#\tothenewprojectfolder.
(UploadAction.
aspxUploadAction.
aspx.
csDefault.
aspx.
csDefault.
aspxTester.
doc)5.
Thenaddexistitems.
.
.
6.
ModifytheServerPortintheDefault.
aspx.
6.
Run.
AbouttheIEProtectionModeThecomponentcan'trunattheIEprotectionmode.
SotheclientneedsaddthesiteinIEtrustedsitelist.
ThecomponentwillpopupthereminderdialogifitrunattheIEprotectionmode.
ConverttoFullVersionThetrialversionhas60daylimiation.
Afteryouputtheorder,youwillgetthefullversiondownloadlinkandthelicensekey.
Step:1.
Firstlyyouneeduninstallthetrialversionfromyourcomputer.
Makesuretheedword.
ocxfilehasbeenremovedfromyourcomputercompleted.
2.
Installthefullversion.
Intheinstallfolder,youcanfindallfilestoredistribute.
3.
ForVC,VB,C#destopapplication,youcansetLicenseNameandLicenseCodepropertydirectlyinthePropertypanel.
4.
ForWebApplication,youneedsetthetwoproperiesintheNotifyCtrlReadyevent.
functionedword_NotifyCtrlReady(){document.
edword.
LicenseName="yourlicensename";document.
edword.
LicenseCode="yourlicensekey";}5.
Atlastyoucancalltheedword.
AboutBoxmethodtoverifythelicense.
Thetrialversionwillshow"30daytriallicenseforevaluation".
Butthefulllicenseversionwillshowyourlicensename.
OnlineStore:http://www.
edrawsoft.
com/edword.
phpLicenseAgreement:http://www.
edrawsoft.
com/download/edcomponentlicenseagreement.
pdfSupportEmail:support@ocxt.
com

PacificRack(年付低至19美元),夏季促销PR-M系列和多IP站群VPS主机

这几天有几个网友询问到是否有Windows VPS主机便宜的VPS主机商。原本他们是在Linode、Vultr主机商挂载DD安装Windows系统的,有的商家支持自定义WIN镜像,但是这些操作起来特别效率低下,每次安装一个Windows系统需要一两个小时,所以如果能找到比较合适的自带Windows系统的服务器那最好不过。这不看到PacificRack商家有提供夏季促销活动,其中包括年付便宜套餐的P...

CloudServer:$4/月KVM-2GB/50GB/5TB/三个数据中心

CloudServer是一家新的VPS主机商,成立了差不多9个月吧,提供基于KVM架构的VPS主机,支持Linux或者Windows操作系统,数据中心在美国纽约、洛杉矶和芝加哥机房,都是ColoCrossing的机器。目前商家在LEB提供了几款特价套餐,最低月付4美元(或者$23.88/年),购买更高级别套餐还能三个月费用使用6个月,等于前半年五折了。下面列出几款特别套餐配置信息。CPU:1cor...

Contabo美国独立日促销,独立服7月€3.99/月

Contabo自4月份在新加坡增设数据中心以后,这才短短的过去不到3个月,现在同时新增了美国纽约和西雅图数据中心。可见Contabo加速了全球布局,目前可选的数据中心包括:德国本土、美国东部(纽约)、美国西部(西雅图)、美国中部(圣路易斯)和亚洲的新加坡数据中心。为了庆祝美国独立日和新增数据中心,自7月4日开始,购买美国地区的VPS、VDS和独立服务器均免设置费。Contabo是德国的老牌服务商,...

conn.asp为你推荐
cisco2960配置cisco4506与2960的vlan配置字节跳动回应TikTok易主#北京字节跳动科技有限公司#小说审核有三面么?我面试了两轮就叫我回家等消息了 要是刷下来了也该告重庆网站制作重庆网站制作,哪家公司服务,价格都比较好?宜人贷官网宜人财富怎么样?瑞东集团请问富源集团到底是一个怎么样的集团?即时通请问有没有人知道即时通是什么?怎样先可以开??佛山海虹广东海虹药通电子商务有限公司怎么样?网络u盘你们谁知道网络硬盘怎么用drupal教程搭建一个多店家订餐网站,可以用joomla,wordpress完成吗?求教程discuz论坛discuz论坛怎么做
网络域名 域名服务器 万网域名空间 拜登买域名批特朗普 韩国空间 博客主机 koss 网通ip cpanel空间 免费mysql 申请个人网站 东莞数据中心 爱奇艺vip免费领取 申请网站 德隆中文网 服务器论坛 supercache 空间申请 创速 中国电信宽带测速 更多