View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Saving entire sheet to SQL Server 2k: XML? values+formats.

Thank you AA2e72E

As i received your reply, i was just finishing my testing(See bellow).
- my code is in an addin. I use classes to capture events. It works fine on
this side.
- I have more issues with Sql Server 2k as i just know the basics.
- how do you save an xl file in its original format to a sql server (IMAGE)?
I don't know how to do that. Do you have a quick sample code? (i'll google it
right away though)

What i have tested so far:
- i save the file as XML Spreadsheet (which keeps most formats)
- i read the file via FileSystemObject.FIle.OpenAsStream
- i sql it to sql server to ntext column.
I do the oposite process to load it into excel.

In terms of performance, loading the file from server or saving it to server
takes less than 3 seconds.
Well, the server is on my physical machine, (but not local), on a virtual
machine, so it will certainly be slower at work through vpn.

In term of size, my regular xl files are around 100k in size, the xml files
are 5 times larger, around 500k. Any idea on how to reduce this size.

If anybody has a better way of doing this, please let me know.

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"AA2e72E" wrote:

Just some thoughts:

If you are going to write anything to SQL Server, write the XLS file itself
rather than some other form it (e.g. CSV, XML etc). An IMAGE (i.e. BLOB)
field can hold 4GB file sizes.

SQL Server, subject to configuration that may be allowed at your site, can
read Excel files directly BUT you would lose the formatting, which you say is
one of your requirements.

Consider writing code in a Workbook to read/write the BLOB from SQL Server
on demand and save it as an AddIn; your users can checkin this Addin in any
workbook and call this functionality. You would need to handle the automatic
archiving of a workbook via Workbook events ... see this topic in the Excel
help files.