Skip to content

ReplaceTextWithObject does not work with List #488

Description

@yvesInnofactory

Using Version 5.0.25228.6154

I want to replace a Placeholder Text with a BulletList.

`private static void ReplaceTextWithBulletList(DocX document, string searchValue, List replaceValue)
{

var addListOptions = new ListOptions()
{
    ListType = ListItemType.Bulleted
};
var bulletList = document.AddList(addListOptions);

foreach (var item in replaceValue)
{
    bulletList.AddListItem(item);
}

var replaceTextOptions = new ObjectReplaceTextOptions()
{
    SearchValue = searchValue,
    NewObject = bulletList

};
document.ReplaceTextWithObject(replaceTextOptions);

}`

At runtime, I get the error:

System.ArgumentException: 'Unknown object received. Valid objects are Picture, Hyperlink or Table.'

How can I replace Text with a Bullet List?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions