By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

C# and Excel Suggetion

P: n/a
Hi

I need some hints for the following problem.

We have some customer that has one Excel file composed of about 20
sheets and he wants to convert this file to a small C# application.
It's not that he does not want to use Excel at all, but there is data
that has to be entered inside the first sheet and from this data all
other sheets are calulated.
Now he wants us to write some app, where his customers are able to
enter the required data into text-fields and this data should be
passed to an excel file. Doing this excel would calculate all other
sheet-fields.
Now those calculated values must be grabed and passed to an other
excel file, which does NOT hold the formulas for the calculation but
also has some additional charts and graphics which relay on the
calculated values.
This new excel file should then be shown to the user.

I thought of holding the "master" file inside a database and just
opening the excel sheet via automation in memory (just don t call
Show) and pass the entered values to this file and then opening a new
file (from a template) passing the calculated values, deleting the
temporary "master" file and then showing the final one.
The sheets of the "master" file will be password protected (to have at
least a litte security).

What do you think of this approach? Would you recomend to do the
complete proceses different?

_thanks in advance

rene

Jul 16 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a

A couple of basics:

You can use an IDataReader to read excel. You can also load the excel data
into a dataset.

Excel also has a "xml standard". To see this quickly, load an excel file
up, do a "Save As (Xml)", and then load the result file into notepad.

The last time I used the xml/excel thing, you could NOT embedd object graphs
into it.

the third hint is:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!148.entry
but this one doesn't exactly apply to you.

..............

You may want to look at the asrose excel toolkit as well.
http://www.aspose.com/Products/Aspose.Grid/Default.aspx
Those are some hints. Not a direct answer though.


<re*********@googlemail.comwrote in message
news:11**********************@o61g2000hsh.googlegr oups.com...
Hi

I need some hints for the following problem.

We have some customer that has one Excel file composed of about 20
sheets and he wants to convert this file to a small C# application.
It's not that he does not want to use Excel at all, but there is data
that has to be entered inside the first sheet and from this data all
other sheets are calulated.
Now he wants us to write some app, where his customers are able to
enter the required data into text-fields and this data should be
passed to an excel file. Doing this excel would calculate all other
sheet-fields.
Now those calculated values must be grabed and passed to an other
excel file, which does NOT hold the formulas for the calculation but
also has some additional charts and graphics which relay on the
calculated values.
This new excel file should then be shown to the user.

I thought of holding the "master" file inside a database and just
opening the excel sheet via automation in memory (just don t call
Show) and pass the entered values to this file and then opening a new
file (from a template) passing the calculated values, deleting the
temporary "master" file and then showing the final one.
The sheets of the "master" file will be password protected (to have at
least a litte security).

What do you think of this approach? Would you recomend to do the
complete proceses different?

_thanks in advance

rene

Jul 16 '07 #2

P: n/a
On Mon, 16 Jul 2007 07:01:01 -0700, re*********@googlemail.com
<re*********@googlemail.comwrote:
[...]
Now he wants us to write some app, where his customers are able to
enter the required data into text-fields and this data should be
passed to an excel file.
Personally, it seems to me that you would be better off programming the
user-input form in Excel, rather than trying to get an external C#
application to work with Excel.

Not that the latter can't be done, but you'll have to jump through some
hoops, whereas if you code in Excel itself, it'll just work. You'll have
direct access to the spreadsheet(s) you want to interact with.

You might have to learn Visual Basic (very easy, especially if you already
know the Microsoft .NET languages), since I'm not sure whether you can
code C# directly from within the Excel macro IDE.

Alternatively, you mentioned using automation, which I think you ought to
be able to use simply to get the user input into Excel and operate on
whatever Excel objects you want. I don't see any particular problem
keeping the data in a database rather than an Excel spreadsheet
(especially if it's really database-like in nature), but I don't think
that aspect of the question has a direct bearing on how you implement the
UI.

Pete
Jul 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.