When the sheet name is specified as $Property$, it auto splits into multiple sheets if the property is enumerable, Supports template for nested objects #959
Conversation
{{Funds.Id}} {{Funds.Name}} {{Funds.Identity.Id}} {{Funds.Identity.Type}} {{Funds.SetupDate.Year}}
There was a problem hiding this comment.
Code Review
This pull request introduces multi-sheet expansion capabilities and enhanced object flattening with circular reference protection to the OpenXml template engine. The reviewer identified several critical bugs, including a double increment of the sheet index that breaks file relationships and a loop termination issue that prevents processing multiple template sheets. Additionally, feedback was provided regarding redundant type checks, inefficient regex instantiation, unnecessary decimal parsing, and missing namespace imports required for cross-platform compilation.
| if (await HookSheetProcess(outputFileArchive, realSheetName, templateSharedStrings, sheetIdx, allSheetInfos, templateSheet, templateFullName, inputValues, cancellationToken).ConfigureAwait(false)) | ||
| break; |
There was a problem hiding this comment.
Breaking the loop when HookSheetProcess returns true prevents any subsequent template sheets from being processed. If a template contains multiple sheets and one of them uses the expansion logic, all sheets following it will be missing from the output file. Furthermore, sheetIdx is passed by value, so the caller's index is not updated after expansion, which would cause file name conflicts if the loop were to continue.
|
Thank you for your contribution, I will try to evaluate it as soon as possible. Please change the title and description to include a more detailed description of the intents of the PR. |
|
Hello @iyumot, I apologize but I haven't had the time to properly analyse the PR. |
|
Hello @iyumot could you please address my previous comment concerning the Chinese comments in your code? Thank you. |
with template
model
`
public record struct Identity(int Type, string Id);
`
with data
specify sheetname by SheetName property, if not exist set as what in $$ plus 1,2,3
result


