Clippit icon indicating copy to clipboard operation
Clippit copied to clipboard

remove caracters to prevent > at document assembler

Open luizfbicalho opened this issue 2 years ago • 3 comments

In some cases I have page breaks or line breaks between the assembly and I get this issue image

luizfbicalho avatar Sep 14 '22 14:09 luizfbicalho

@luizfbicalho can you please explain why this change actually fix the issue? (it looks very magical 😁)

Or/better add simple test that reproduce this behavior without this change.

sergey-tihon avatar Sep 14 '22 19:09 sergey-tihon

@luizfbicalho can you please explain why this change actually fix the issue? (it looks very magical 😁)

Or/better add simple test that reproduce this behavior without this change.

In some cases, there is one character in the middle of the replace that is a line break or a page break, and this character doesn't add 1 to the lenth of the string, this way the replaced string is one string smaller than the template string and when the replace happens, one ">" remains on the result document, I'll try to create a test here

luizfbicalho avatar Sep 14 '22 20:09 luizfbicalho

Now I have different results in OpenXmlPowerTools and in Clippit correct.docx error.docx

But the clippit result in test doesn't have the > charactere in the error.docx any idea whats going on?

DA-TemplateMaior-processed-by-DocumentAssembler.docx

The test is the DA-templateMaior.docx and DA-templateMaior.xml, if you run them on old power tools you get the >

The element that I'm filtering is this

<r xmlns="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
  <lastRenderedPageBreak />
</r>

this element in this code has the Ch property as null or empty

var charsAndRuns = runsTrimmed
    .Select(r => new { Ch = UnicodeMapper.RunToString(r), r })
    //.Where(w => !string.IsNullOrEmpty(w.Ch))
    .ToList();

but for some reason this element doesn't appear on the list.

luizfbicalho avatar Sep 14 '22 22:09 luizfbicalho

This Is solved by the #58 PR

luizfbicalho avatar Oct 04 '22 19:10 luizfbicalho