Hi
Is it possible to create named ranges for groups created using the smart markers feature?
We need dynamic/named references to the group sums for further evaluations. Unfortunately the number of rows varies depending on the report type so we cannot use static cell names like C5
See images.
Or is there another possibility to achieve this?
Using Aspose.Cells 7.2.2.0
Hi,
Thanks for your posting and using Aspose.Cells for .NET.
Please see the following sample demo and let us know if it is helpful for you.
Here, you do not need to worry about the number of your data rows.
See the following code and source xlsx file which has a smartmarker tag and the output file generated by the code. As you can see, in output file, not only all the data rows has been output but also their sum is output in last row.
I have used a dummy list data source, definitely, you can use dataset.
Please also see the screenshot.
C#
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Aspose.Cells;
namespace TestSmartMarker
{
class Business
{
<span class="kwrd">int</span> m_unit;<br>
public int Unit
{
get { return m_unit; }
set { m_unit = <span class="kwrd">value</span>; }<br>
}<br>
internal Business(int unit)
{
m_unit = unit;
}<br>
}<br>
class Program
{
public static void SmartMarkerExample()
{<br>
<span class="kwrd">string</span> smartMarkerfile = @"F:\Shak-Data-RW\Downloads\SmartFile.xlsx";<br>
IList lst = new List();
lst.Add(<span class="kwrd">new</span> Business(324));<br>
lst.Add(<span class="kwrd">new</span> Business(325));<br>
lst.Add(<span class="kwrd">new</span> Business(326));<br>
lst.Add(<span class="kwrd">new</span> Business(327));<br>
WorkbookDesigner report = new WorkbookDesigner();
report.Workbook = new Workbook(smartMarkerfile);
report.SetDataSource(“Business”, lst);
report.Process(false);
report.Workbook.CalculateFormula();
report.Workbook.Save(smartMarkerfile + “.out.xlsx”, SaveFormat.Xlsx);
}
}
}
Screenshot:
Thank you very much.
The problem is that I have to reference the sum cell (cell A2 in your template, and cell A5 in your output file) from another sheet. I cannot reference with A5 or A2 as this reference points to the wrong cell when the report is filled with data.
Hi,
Thanks for your feedback.
Please provide us the xls/xlsx files as you have shown in the images.
Attachment: 07.08.png
Attachment: 07.08_required.png
You can create them manually using Ms-Excel 2010 and attach here. It will help us look into your problems and we will be able to provide you a solution or workaround.
Here are the xlsx files. As you can see in the file TFS_Manhours_2012_output in the sheet Overview I want to reference the group sums.
Thanks
Thank you very much for your quick help.
I think we will use the Find() features to get the subtotal cells.
Kind regards,
Stephan
Hi,