Solved

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

Posted on 2004-10-20
4
507 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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