Free Support Forum - aspose.com

Function SUM

Hi ,

I was trying to include a SUM FUNCTION in my excel file.

I dont know how many rows come back my dataset. ¿How can I do?

The colum that i have to count is Datos.CP_Presupuesto_Protegido

I attach my excel file.

Thanks.

Hi,


I think you may try to change your Subtotal function in F7 if it works fine for your need:
=SUBTOTAL(9,F3,F4)

When the markers are processed, blank rows are inserted first and then filled with data based on the data source on the back end.

Thank you.

Sorry,

but it isnt work or i dont know how to do it.

Can you attach me the excel file with the function?? Because this function it isnt recognize.

I use Office 2007 but it has to work in ither versions.

Thanks,

IASOFT.

I attach my file.

Hi,


Could you change your formula to:
SUM(F3:F4) if it works fine.

Thank you.

Sorry, but it isnt work.

The result of F10 is with Aspose.Cells, and the result of F12 it was do for me after the ejecution.

Hi,


I have tested your scenario with my test case, it works fine. Please find attached the input file, see the second worksheet markers (especially D7 and E5 cells). Here is my sample code that works fine. I have also attached output file here for your reference.
I am using Aspose.Cells for .NET v6.0.1.2 (attached). I am using MS Access Northwind database tables, please specify the path before running my code.

Sample code:

//Create a connection object, specify the provider info and set the data source.
OleDbConnection con = new OleDbConnection(“provider=microsoft.jet.oledb.4.0;data source=e:\test\Northwind.mdb”);
//Open the connection object.
con.Open();
//Create a command object and specify the SQL query.
OleDbCommand cmd = new OleDbCommand(“Select * from [Order Details] where UnitPrice >100”, con);
//Create a data adapter object.
OleDbDataAdapter da = new OleDbDataAdapter();
//Specify the command.
da.SelectCommand = cmd;
//Create a dataset object.
DataSet ds = new DataSet();
//Fill the dataset with the table records.
da.Fill(ds, “Order Details”);
//Create a datatable with respect to dataset table.
DataTable dt = ds.Tables[“Order Details”];
//Create WorkbookDesigner object.
WorkbookDesigner wd = new WorkbookDesigner();
//Open the template file (which contains smart markers).
wd.Workbook = new Workbook(“e:\test2\SmartMarkerDesigner.xls”);
//Set the datatable as the data source.
wd.SetDataSource(dt);
//Process the smart markers to fill the data into the worksheets.
wd.Process(true);
//Save the excel file.
wd.Workbook.Save(“e:\test2\outSMTest2.xls”);

If you still find the issue, kindly do create a sample console application, zip it and post it here to show the issue, we will check it soon.

Thank you.