HotCell Technology Upload Example |
New in V4
*This feature is not
available in ExcelWriterSE, ExcelWriterLE,
and ExcelWriterFree. |
Editing Cells with Known Positions
The following sample performs the exact same functions as the
POST Example, except it goes about
it in a very different manner. Instead of just submitting the changed cell information to the
server, the entire workbook is uploaded and the values are read from it by ExcelWriter on the
server-side.
Run the Sample
|
Description |
See the Code |
| form.asp |
Entry point to the sample |
[View Source]
|
| GetEmployeeDataSheet.asp |
ExcelTemplate workbook generator |
[View Source]
|
| UplUpdate.asp | Database update handler |
[View Source]
|
| Template.xls |
Template Excel workbook Note: Go to Tools > Macros > Visual Basic Editor to see the VBA code |
[View Template] |
The sample works as follows:
- Form.asp loads and you can select an Employee ID for the individual whose information you
would like to edit. To allow a file upload from the client, an
external object called SoftArtisans.XLWAssistant is required to be installed on the
client machine. This object is included with ExcelWriter in XLWAssis.cab so that your users
can install XLWAssistant on-demand when they first visit form.asp, or any page you
choose. This object must be installed in order for the VBA code in template.xls to
function properly.
To create a client-side instance of XLWAssistant, use the <object>
tag with XLWAssistant's unique class id:
<OBJECT classid="clsid:381A579F-C095-433d-8AEF-96CED6EC227F"
codebase="XLWAssis.cab" id="XLWAssistant"></OBJECT>
The codebase attribute specifies XLWAssistant's location. When you
upgrade XLWAssistant, add the new version number to the codebase value.
This will allow an automatic update of the client version. To find the version
number:
- Extract XLWAssis.dll from XLWAssis.cab
- Right-click XLWAssis.dll
- Open Properties
- Select the Version tab
For example, if the version number is 1.1.1.1. Add "version=1,1,1,1" to the
codebase attribute:
<OBJECT classid="clsid:381A579F-C095-433d-8AEF-96CED6EC227F"
codebase="XLWAssis.cab#version=1,1,1,1" id="XLWAssistant"></OBJECT>
* SoftArtisans.XLWAssistant is not available in ExcelWriterLE.
- Form.asp submits data to GetEmployeeDataSheet.asp, which uses ExcelWriter's ExcelTemplate
object to populate the form with the chosen employee's information.
- In Excel, you can edit the employee's information. In template.xls, the VBA code
in the
btnUpdate_OnClick subroutine saves
the workbook to the client's disk, and uploads the file to UplUpdate.asp. The VBA code in this
version of template.xls uses the XLWAssistant object to
perform the file upload.
- In UplUpdate.asp, SoftArtisans FileUp receives the file and saves it to the server's disk:
Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
oFileUp.Form("FILE").SaveAs Server.MapPath("./upload.xls")
SoftArtisans FileUp is a
server-side file-transfer component. Note that SoftArtisans FileUp
is not included with ExcelWriter.
ExcelWriter opens the file, reads the values from the cells, forms a SQL UPDATE statement,
and executes the query, updating the data source.
Top
Copyright © 2003, SoftArtisans, Inc.