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

LOCVPS全场8折,香港云地/邦联VPS带宽升级不加价

LOCVPS发布了7月份促销信息,全场VPS主机8折优惠码,续费同价,同时香港云地/邦联机房带宽免费升级不加价,原来3M升级至6M,2GB内存套餐优惠后每月44元起。这是成立较久的一家国人VPS服务商,提供美国洛杉矶(MC/C3)、和中国香港(邦联、沙田电信、大埔)、日本(东京、大阪)、新加坡、德国和荷兰等机房VPS主机,基于XEN或者KVM虚拟架构,均选择国内访问线路不错的机房,适合建站和远程办...

NameCheap优惠活动 新注册域名38元

今天上午有网友在群里聊到是不是有新注册域名的海外域名商家的优惠活动。如果我们并非一定要在国外注册域名的话,最近年中促销期间,国内的服务商优惠力度还是比较大的,以前我们可能较多选择海外域名商家注册域名在于海外商家便宜,如今这几年国内的商家价格也不贵的。比如在前一段时间有分享到几个商家的年中活动:1、DNSPOD域名欢购活动 - 提供域名抢购活动、DNS解析折扣、SSL证书活动2、难得再次关注新网商家...

LiCloud:香港CMI/香港CN2+BGP服务器,30Mbps,$39.99/月;香港KVM VPS仅$6.99/月

licloud怎么样?licloud目前提供香港cmi服务器及香港CN2+BGP服务器/E3-1230v2/16GB内存/240GB SSD硬盘/不限流量/30Mbps带宽,$39.99/月。licloud 成立於2021年,是香港LiCloud Limited(CR No.3013909)旗下的品牌,主要提供香港kvm vps,分为精简网络和高级网络A、高级网络B,现在精简网络和高级网络A。现在...

conn.asp为你推荐
德国iphone禁售令德国IPHONE多少钱?急~flashfxp注册码找flashfxp3.4注册码上海市浦东新区人民法院民事判决书(2009)浦民三(知)初字第206号大飞资讯手机出现热点资讯怎么关闭宜人贷官网宜人贷是不是骗局,借了五万,每月还2030元,还十个月了,想一次性还完,他们说我我爱e书网侯龙涛小说那里有下载的电子商务世界世界第一的电子商务网站???oscommerceOscommerce,Magento, Zen-cart 比较,哪个好一点!qq挂件如何使QQ气泡和挂件成为永久的?财务单据会计里各种票据的定义及区分
网站域名备案查询 漂亮qq空间 80vps inmotionhosting webhostingpad gomezpeer sub-process 网站保姆 双11抢红包攻略 天猫双十一秒杀 tightvnc linux空间 免费mysql 腾讯云分析 网络空间租赁 东莞服务器 上海服务器 cloudlink 贵阳电信测速 华为云建站 更多