Free Support Forum - groupdocs.com

Repeat a drawn line in a foreach loop

When using a foreach loop, that encloses a drawn line, the line is only shown on the first iteration of the loop. Which is where it shows in the template. Is there a way to get the line to be shown for each iteration?

1 Like

@dsmeltz

In order to investigate this scenario, we need following details:

  • API version that you are using (e.g. 20.1, 20.6)
  • Sample code
  • Problematic template
  • Expected and API generated output

I’m using v20.4 of the APi.
There’s a C# project in the zip file. A template called LineTestTemplate.docx, has two foreach sections. The first one I entered by hand, the second one, I copied from my problematic template and it exhibits the same behavior, of only printing the line in the first iteration of the foreach loop.GroupDocAssemblerLineTest.zip (16.2 KB)

@dsmeltz

Thank you for the details. We’re investigating this issue with ID ASSEMBLYNET-176. You’ll be notified as there’s any update.

@dsmeltz

We have an update on ASSEMBLYNET-176. Issue is that the graphical objects used by the in the template are not properly anchored.
The most reliable way to achieve this requirement is to use “In Line with Text” layout option for graphical objects as per this screenshot.png (18.9 KB). We’ve modified your template LineTestTemplate-Modified.zip (12.6 KB). Note that we also have to change paragraph spacing to make the modified template closer to the original one. Hopefully it will be helpful.

Thank you! That’s what I need to know. Everything is working now.

Feel free to close the ticket.

1 Like

@dsmeltz

Glad to know that your issue is resolved.