Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 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