Skip to content

Editing text containing a newline causes newline to be replicated exponentially each time #960

@cammurray

Description

@cammurray

We're attempting to use the project for the purpose of populating a template powerpoint, e.g put placeholders in a template powerpoint, and then use ShapeCrawler to replace those placeholders.

This works great, aslong as the source text does not contain 'new line' \n characters. If it contains new lines, what happens is that something within ShapeCrawler is doubling the newline characters.

I've created a sample project (attached) that replicates this issue.

In the sample program we have two identical slides:

Image

The sample program uses a replace on this text as follows:

For slide 1, at a top level.

var Shape1 = _presentation.Slides.First(x => x.Number == 1).Shapes.First(); Shape1.Text = Shape1.Text.Replace("World", "Earth");

For slide 2, at a paragraph level

var Shape2 = _presentation.Slides.First(x => x.Number == 2).Shapes.First(); Shape2.TextBox.Paragraphs.First().Text = Shape2.TextBox.Paragraphs.First().Text.Replace("World", "Earth");

The resulting slides will look like this:

Image

If you inspect the text after doing the replace, you will notice that ShapeCrawler is doubling the qty of newline characters between Hello and World.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions