?? 311765 - sample visual c++ activex control for hosting office documents in visual basic or html.htm
字號:
<TD><FONT size=2>Dsoframer.ocx</FONT></TD>
<TD><FONT size=2>52.5 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>Eula.txt</FONT></TD>
<TD><FONT size=2>2.23 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Classfactory.cpp</FONT></TD>
<TD><FONT size=2>3.64 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsofauto.cpp</FONT></TD>
<TD><FONT size=2>22.8 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsofcontrol.cpp</FONT></TD>
<TD><FONT size=2>85.4 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsofdocobj.cpp</FONT></TD>
<TD><FONT size=2>60.1 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsofdocobj.h</FONT></TD>
<TD><FONT size=2>8.95 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsoframer.def</FONT></TD>
<TD><FONT size=2>205 bytes</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsoframer.dsp</FONT></TD>
<TD><FONT size=2>6.45 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsoframer.dsw</FONT></TD>
<TD><FONT size=2>541 bytes</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Dsoframer.h</FONT></TD>
<TD><FONT size=2>18.7 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Mainentry.cpp</FONT></TD>
<TD><FONT size=2>8.2 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Rbbinder.h</FONT></TD>
<TD><FONT size=2>7.83 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Utilities.cpp</FONT></TD>
<TD><FONT size=2>19.3 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Utilities.h</FONT></TD>
<TD><FONT size=2>7.05 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Version.h</FONT></TD>
<TD><FONT size=2>1.77 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Lib\Dsoframer.odl</FONT></TD>
<TD><FONT size=2>6.40 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Lib\Dsoframer.olb</FONT></TD>
<TD><FONT size=2>6.85 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Lib\Dsoframerlib.h</FONT></TD>
<TD><FONT size=2>5.58 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Res\Dso.ico</FONT></TD>
<TD><FONT size=2>318 bytes</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Res\Dsoframer.rc</FONT></TD>
<TD><FONT size=2>3.73 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Res\Resource.h</FONT></TD>
<TD><FONT size=2>1.12 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Source\Res\Toolbox.bmp</FONT></TD>
<TD><FONT size=2>334 bytes</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Webtest\Bottomcurve.gif</FONT></TD>
<TD><FONT size=2>179 bytes</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Webtest\Lefttopcurve.gif</FONT></TD>
<TD><FONT size=2>89 bytes</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Webtest\Mslogo.gif</FONT></TD>
<TD><FONT size=2>1.62 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Webtest\Officelogo.gif</FONT></TD>
<TD><FONT size=2>5.25 KB</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Webtest\Righttopcurve.gif</FONT></TD>
<TD><FONT size=2>88 bytes</FONT></TD></TR>
<TR>
<TD><FONT size=2>.\Webtest\Webtest.htm</FONT></TD>
<TD><FONT size=2>7.75
KB</FONT></TD></TR></TBODY></TABLE></SPAN>
<H3>The DSO Framer ActiveX Document Control Sample</H3>The
sample is written in Visual C++ 6.0 using plain C++, with no
Microsoft Foundation Classes (MFC) or Active Template Library
(ATL). A release build of the sample is provided for those who
want to demonstrate the control without having to recompile
the project. A Web page example is provided in the WebTest
folder to show how the control can be used from HTML. Office
97, Office 2000, or Office XP must be installed on the client
computer for it to be able to open Office documents.<BR><BR>
<H4>Run the Sample</H4>To run the samples, follow these steps:
<OL class=dec>
<LI>Extract the sample files to a folder of your choice.
<LI>Click the <STRONG>Start</STRONG> button, click
<STRONG>Run</STRONG>, and then type the following to
register the control:<PRE> regsvr32 [FullPathToFile]\dsoframer.ocx
</PRE>
<LI>Open Webtest.htm (from the WebTest folder) in Internet
Explorer. If you are prompted, select <STRONG>Yes</STRONG>
to enable scripting for an ActiveX control.
<LI>When you see the control in the Web page, click the icon
in the title bar of the control to display a
<STRONG>File</STRONG> menu that you can use to insert or
create an object.</LI></OL>
<H4>Code a Solution Using the Control</H4>The control is very
customizable. You can change the color scheme of any of the
control elements, as well as determine the border type and a
custom caption. These can be set at run time or design time as
needed.<BR><BR>The control also supports a property called
<STRONG>ActiveDocument</STRONG> that allows you to obtain a
reference to the <STRONG>IDispatch</STRONG> 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: <PRE> Dim oDoc As Word.Document
Set oDoc = DsoFramer1.ActiveDocument
oDoc.Content.Text = "This was added by Automation"
</PRE>The ability to control the object while the object
is embedded is very powerful.<BR><BR><STRONG>NOTE</STRONG>:
Automation of the control from HTML script over the Web can be
very dangerous to a user, so the control has purposely been
marked as NOT "Safe for Scripting". Users who use the control
in Web pages may be prompted to enable scripts before they use
this control. This is required for proper security.<BR><BR>
<H4>Create New Documents</H4>The component allows you to
create new documents for any ActiveX document type that is
registered on the system. A user can use the built-in
functionality of the <STRONG>New</STRONG> dialog box from the
menu, or use a custom function that you provide to create new
documents.<BR><BR>The <STRONG>CreateNew</STRONG> method on the
control allows you to build your own method to start new
documents. The method takes a Programmatic Identifier (ProgId)
of the ActiveX document type that you want to start. For
example, you can use the following Office
ProgIds:<BR><BR><SPAN class=weboutput><FONT size=2>
<TABLE borderColor=#000000 cellSpacing=0 cellPadding=4
width="80%" align=center borderColorLight=#ffffff border=1>
<TBODY>
<TR>
<TH bgColor=#c0c0c0><FONT size=2>Office Document
Type</FONT></TH>
<TH bgColor=#c0c0c0><FONT size=2>ProgID</FONT></TH></TR>
<TR>
<TD><FONT size=2>Excel Spreadsheet</FONT></TD>
<TD><FONT size=2>"Excel.Sheet"</FONT></TD></TR>
<TR>
<TD><FONT size=2>Excel Chart</FONT></TD>
<TD><FONT size=2>"Excel.Chart"</FONT></TD></TR>
<TR>
<TD><FONT size=2>PowerPoint Presentation</FONT></TD>
<TD><FONT size=2>"PowerPoint.Show"</FONT></TD></TR>
<TR>
<TD><FONT size=2>Project Project</FONT></TD>
<TD><FONT size=2>"MSProject.Project"</FONT></TD></TR>
<TR>
<TD><FONT size=2>Visio Drawing</FONT></TD>
<TD><FONT size=2>"Visio.Drawing"</FONT></TD></TR>
<TR>
<TD><FONT size=2>Word Document</FONT></TD>
<TD><FONT
size=2>"Word.Document"</FONT></TD></TR></TBODY></TABLE></SPAN><BR>If
the ProgId is not recognized or the server cannot be started,
you receive one of the standard error messages that are
discussed in the "Custom Error Messages" section.
<H4>Open Documents</H4>You can also open and edit Office
documents that exist on a local drive, Universal Naming
Convention (UNC) share, or Web folder. A standard
<STRONG>Open</STRONG> dialog box that can be displayed by the
user or called by code has been provided, and allows the user
to find and select a file to open. You can also call the
<STRONG>Open</STRONG> method directly and give the control a
specific file to open.<BR><BR><STRONG>Open</STRONG> takes
either a qualified file path or a URL to a file on a remote
Web server. The control attempts to gain write access to the
file and keep it locked for editing unless you pass True for
the <EM>ReadOnly</EM> parameter. For example, the following
code opens a local file and keeps a lock on it for editing: <PRE> DsoFramer1.Open "C:\TestBook.xls"
</PRE>If you want to open a file that is not associated
with an Office application but that can be loaded with Office,
you can specify an alternate ProgId in the
<STRONG>Open</STRONG> method. For example, to open a plain
text file in Word, you can use code that resembles the
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -