Solved

Hot to calculate sum of a range in a spreadsheet using OWC

Posted on 2004-10-20
4
500 Views
Last Modified: 2012-06-21
Hello,

I am using Office Web Component to populate a spreadsheet within ASP.net. the spreadsheet contains numerous figures. What I need to do is create a grand total line within the spreadhseet.
Can any one tell me how to do this  dynamically? the number of rows within the spreadsheet may vary over time depending on the results of the query

Thanks In Advance

0
Comment
Question by:anwarmir
4 Comments
 

Accepted Solution

by:
oliviersanzot earned 300 total points
ID: 12358995
Hi,

I'm using owc10 from a VB6 app, I guess there are not much differences from ASP.
This sample will create a formula in cell(1,1) of a worksheet :
sheet1.Cells(1,1).formulalocal="=SUM(D5:D10)"

I would do something like this :

1. Get Start Row
Loop until recordset.eof
    Add a row
end loop
Get End Row

2. Create a formula string "=SUM(xx:yy)"

3. Assign Formula.

I guess that knowing start row and end row of the range you want to sum, you could easily create the formula string replacing the column index by its corresponding letter.
Hope this helps,

Olivier
0
 

Author Comment

by:anwarmir
ID: 12443240
Sorry for the delay getting back to you...The solution provided works fine. Thanks..
However I have a one more question do you know how to wrap text using OWC has I nedd to fit my whole sheet on the Screen ?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now