Solved

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

Posted on 2004-10-20
4
503 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …

831 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