Hi,
Thanks for the template files.
Well, I have tested your scenario/ case using the following sample code with your template file a bit. I have checked your template files as well. I think it would be difficult to do exactly the same output as per your “myOutput.xlsx” file. Smart Markers’ grouping data feature has its own syntax and architecture to place data/ information in the cells. In your desired output file, under your each grouping row/field “PaymentType” you need data from “StockSale” field. I did try to insert a new row above in the template file and place/ move the first grouping marker there above all but this won’t work either.
&=Model.PaymentType(Group:normal) |
|
|
|
|
|
|
&=Model.StockSale |
&=Model.OpeningBalance |
&=Model.Arised |
&=Model.Payment |
&=&=TEXT(D{r}+E{r}-F{r},
"#,###.000") |
|
|
&=subtotal9:Model.Order(Label:"Tổng",
LabelPosition:-2) |
&=subtotal9:Model.Order |
&=subtotal9:Model.Order |
&=subtotal9:Model.Order |
I think you may try to use the marker "&=Model.PaymentType(Group:normal, skip:1)" instead but then it will still not provide you the exact formatting as you need your each grouping record should be placed in one complete row and its details records should be placed under it accordingly.
e.g
Sample code:
Workbook workbook = new Workbook(@"e:\test2\ExcelTemplate.xlsx");
WorkbookDesigner designer = new WorkbookDesigner(workbook);
DataTable dt = workbook.Worksheets[1].Cells.ExportDataTable(1, 1, workbook.Worksheets[1].Cells.MaxRow + 1, workbook.Worksheets[1].Cells.MaxColumn + 1, true);
dt.TableName = "Model";
designer.SetDataSource(dt);
designer.Process();
designer.Workbook.Save(@"e:\test2\out1.xlsx");
Smart Markers have different style and formatting regarding the grouping records and placements of summary rows etc.as you may get reference from the document under "Grouping data" sub-heading:
I think may be you need to adopt manual approach to accomplish your task instead of using only smart markers where you have to insert new rows at certain places and format them as per your needs. Then, you need to move each grouping record to it or something like that etc..
We will further check if we could find some good way or better workaround to do that. And if we found, we could get back to you.
Thank you.