Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

creating excel spreadsheets server side dynamically


Hi there,

I am trying to find out what the best way of creating an excel
spreadsheet is, this will need to be done dynamically by an aspx website
on the server side.

The main way would be to use the Excel com object that is available when
you have excel installed, however since this is done server side I need
to be sure that it won't generate any dialog box error messages.  There
are also concerns about threading.

Most of the examples I can find on the web seem to be quite old, has
anyone recently done this who could share their thoughts ?.

Any help appreciated.

Regards.

"Andy Burchill" <andyburch@clara.co..uk> wrote in message

news:1181036102.54643.0@iris.uk.clara.net...

> I am trying to find out what the best way of creating an excel spreadsheet
> is, this will need to be done dynamically by an aspx website on the server
> side.

> The main way would be to use the Excel com object that is available when
> you have excel installed

You can't do server-side automation of Office - Microsoft don't support it
because it doesn't work:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

> There are also concerns about threading.

Threading will be the least of your worries, believe me! Don't even
contemplate this...

> Most of the examples I can find on the web seem to be quite old, has
> anyone recently done this who could share their thoughts ?.

There are three ways to achieve what you need:

1) Use HTML
Create an HTML document and then give it a .xls extension. This is extremely
easy, and is free - however, you won't be able to have multiple worksheets.

2) Use XML
http://www.microsoft.com/downloads/details.aspx?FamilyID=fe118952-354...
http://www.microsoft.com/downloads/details.aspx?familyid=15805380-f2c...

This is extremely powerful, and is free, but is most definitely not for the
faint-hearted...

3) Use Aspose
http://www.aspose.com/Products/Aspose.Cells/Default.aspx

This is extremely powerful and extremely easy to use, but it's not free.

--
http://www.markrae.net

-----------------------------------------------Reply-----------------------------------------------

On 5 Jun, 10:34, Andy Burchill <andyburch@clara.co..uk> wrote:

Export the data in csv format. Later on csv file can be open using
Excel or notepad and still its free.

-----------------------------------------------Reply-----------------------------------------------

-pb- wrote:
> Export the data in csv format. Later on csv file can be open using
> Excel or notepad and still its free.

That is certainly one option, however I was interested in doing some
formatting in the excel file.  Its supposed to be a kind of order form
so making it look good would be beneficial.  There are many different
types of product though so it needs to be able to be generated dynamically.

Regards.

-----------------------------------------------Reply-----------------------------------------------

"eps" <e@mailinator.com> wrote in message

news:%23j7GPT2pHHA.4396@TK2MSFTNGP02.phx.gbl...

> That is certainly one option, however I was interested in doing some
> formatting in the excel file.  Its supposed to be a kind of order form so
> making it look good would be beneficial.  There are many different types
> of product though so it needs to be able to be generated dynamically.

Did you see my reply to Andy Burchill...?

--
http://www.markrae.net

-----------------------------------------------Reply-----------------------------------------------

"Andy Burchill" <andyburch@clara.co..uk> wrote in message

news:1181036102.54643.0@iris.uk.clara.net...

> Hi there,

> I am trying to find out what the best way of creating an excel spreadsheet
> is, this will need to be done dynamically by an aspx website on the server
> side.

> The main way would be to use the Excel com object that is available when
> you have excel installed, however since this is done server side I need to
> be sure that it won't generate any dialog box error messages.  There are
> also concerns about threading.

> Most of the examples I can find on the web seem to be quite old, has
> anyone recently done this who could share their thoughts ?.

> Any help appreciated.

What about using OWC? It is recent. It's ASP.NET using VB.NET with the
example, but I don't see why you can't do it in C#. I have taken VB.NET
examples and done them in C#.

http://www.4guysfromrolla.com/webtech/022801-1.shtml

-----------------------------------------------Reply-----------------------------------------------

"Andy Burchill" <andyburch@clara.co..uk> wrote in message

news:1181036102.54643.0@iris.uk.clara.net...

> Hi there,

> I am trying to find out what the best way of creating an excel spreadsheet
> is, this will need to be done dynamically by an aspx website on the server
> side.

> The main way would be to use the Excel com object that is available when
> you have excel installed, however since this is done server side I need to
> be sure that it won't generate any dialog box error messages.  There are
> also concerns about threading.

> Most of the examples I can find on the web seem to be quite old, has
> anyone recently done this who could share their thoughts ?.

Also check out www.tmssoftware.com for a product called FlexCel.

PS

-----------------------------------------------Reply-----------------------------------------------

As you hopefully have gathered by now, you do NOT want to try to use Excel on
the Server as there are all kinds of problems, and it was never designed for
this.

You could take a look at this:
http://www.carlosag.net/Tools/ExcelXmlWriter/Default.aspx

Peter
--
Site:  http://www.eggheadcafe.com
UnBlog:  http://petesbloggerama.blogspot.com
Short urls & more:    http://ittyurl.net

"Peter Bromberg [C# MVP]" <pbromb@yahoo.yabbadabbadoo.com> wrote in
message news:7E438E03-88C3-44FC-87AF-EF6BA9D42AD8@microsoft.com...

Wow! That looks superb - have you tried it yourself...?

--
http://www.markrae.net

-----------------------------------------------Reply-----------------------------------------------

Mark Rae wrote:
> "Peter Bromberg [C# MVP]" <pbromb@yahoo.yabbadabbadoo.com> wrote in
> message news:7E438E03-88C3-44FC-87AF-EF6BA9D42AD8@microsoft.com...

>> You could take a look at this:
>> http://www.carlosag.net/Tools/ExcelXmlWriter/Default.aspx

> Wow! That looks superb - have you tried it yourself...?

I had already come across this whilst searching on the web, I think this
is almost exactly what I want as I have already prototyped my app and it
works well.

The major drawback that I can see is that you need Excel 2003 or later
to read an XML spreadsheet that it produces. (An the free Excel Viewer
app does not seem to want to display them at all).

Regards.

-----------------------------------------------Reply-----------------------------------------------

Mark Rae wrote:
> "eps" <e@mailinator.com> wrote in message
> news:%23j7GPT2pHHA.4396@TK2MSFTNGP02.phx.gbl...

>> That is certainly one option, however I was interested in doing some
>> formatting in the excel file.  Its supposed to be a kind of order form
>> so making it look good would be beneficial.  There are many different
>> types of product though so it needs to be able to be generated
>> dynamically.

> Did you see my reply to Andy Burchill...?

Yes I did, thanks for replying.  I take your point about Microsoft not
supporting creating them server side.

Regards.

-----------------------------------------------Reply-----------------------------------------------

"Andy Burchill" <andyburch@clara.co..uk> wrote in message

news:1181051251.73389.0@iris.uk.clara.net...

> I had already come across this whilst searching on the web, I think this
> is almost exactly what I want as I have already prototyped my app and it
> works well.

> The major drawback that I can see is that you need Excel 2003 or later to
> read an XML spreadsheet that it produces. (An the free Excel Viewer app
> does not seem to want to display them at all).

Hmm...

Obviously, Aspose creates "native" Excel files, but it isn't free...

--
http://www.markrae.net

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc