Carlove
Carlove

Reputation: 449

C# Programming an ENTER into a document

I'm using NovaCode and trying to fill a list in a document at a specific paragraph. I am able to build the list but the numbering doesn't go further than 1.

example:

1. Number one
   Number two
   Number three
   Number four

I have tried \r, \n and \r\n ( and a bunch of other ), but they all seem to just do "shift+enter" instead of an actual enter. The latter continues the numbering.

Is there a way to increment this using NovaCode? You can create lists with NovaCode but it's impossible to insert them into paragraphs.. ( I'm replacing fields in an existing document )

Code:

            VariableValue listorderlinenames = factory.Variables.FirstOrDefault(x => x.Name == "[Offer.Orderline.OrderLineNames]");
            Paragraph foundlistorderlinenames = factory.Document.Paragraphs.Where(x => x.Text.IndexOf(listorderlinenames.Name) >= 0).FirstOrDefault();
            foreach (Orderline orderline in offer.OrderLines)
            {
                foundlistorderlinenames.IndentationBefore = 3;
                foundlistorderlinenames.Append(counter + 1 + ". " + orderline.Name);
                foundlistorderlinenames.Append("\r\n");
            }

This is the ugly way I'm doing it, making a fake list.

Upvotes: 1

Views: 169

Answers (1)

simonecosci
simonecosci

Reputation: 1204

maybe this:

List list = doc.AddList("item 1", 0, ListItemType.Numbered);

Upvotes: 0

Related Questions