Queries about using the grouping capabilities of smart marker feature

Last post 04-30-2009, 7:04 AM by Amjad Sahi. 2 replies.
Sort Posts: Previous Next
  •  04-29-2009, 9:45 AM 177290

    Queries about using the grouping capabilities of smart marker feature

    Attachment: Present (inaccessible)
    Hi,

    I have some queries on grouping option of smart markers. I am using 'group:repeat' option
    1) Is it possible to print a constant text (i.e. "Sub Total") on the rows where subtotal is displayed?
    2) Is it possible to repeat the grouped data (i.e. the data on which grouping is performed) on the rows where subtotals are being displayed?

    I am attaching a screen shot for ready reference.


    Thanks
    Manu


    This message was posted using Page2Forum (attachment) from Smart Markers - Aspose.Cells for .NET and Java
     
  •  04-30-2009, 12:58 AM 177413 in reply to 177290

    Re: Queries about using the grouping capabilities of smart marker feature

    Hi,

    Thank you for considering Aspose.

    Well, I am Afraid, this feature is not supported by Aspose.Cells at the moment. You may have to write your own code to get your desired results.

    Thank You & Best Regards,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  04-30-2009, 7:04 AM 177461 in reply to 177413

    Re: Queries about using the grouping capabilities of smart marker feature

    Attachment: Present (inaccessible)

    Hi,

    Well, your desired feature may not be supported in Smart Markers, but, I think you may try our new feature Subtotals (supported in latest version v4.7.1), check the doc topic: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/creating-a-list-object.html

    I have created a sample code for your need. In the example, I used Smart Markers and process the markers to fill the data into the worksheet cells. Then, I utilized the Subtotals feature to accomplish your desired results. Please see the input file first, check the second worksheet's smart markers. The output file is also attached. I utilized Northwind Access sample database for the demo.

    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=f:\\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]", 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.Open("f:\\test\\SmartMarker_Designernew1.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);


                      //Get the Cells collection in the first worksheet
                      Cells cells = wd.Workbook.Worksheets[1].Cells;
                      //Create a cellarea i.e.., B3:C19
                      CellArea ca = new CellArea();
                      ca.StartRow = 4;
                      ca.StartColumn = 0;
                      ca.EndRow = cells.MaxDataRow;
                      ca.EndColumn = cells.MaxDataColumn;
                      //Apply subtotal, the consolidation function is Sum and it will applied to
                      //some columns in the list
                      cells.Subtotal(ca, 0, ConsolidationFunction.Sum, new int[] { 2,3 });

                      //Save the excel file.
                      wd.Save("f:\\test\\outSmartMarker_Designernew1.xls");
     
     
    Thank you.

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
View as RSS news feed in XML