DocX icon indicating copy to clipboard operation
DocX copied to clipboard

ReplaceTextWithObject does not work with List

Open yvesInnofactory opened this issue 4 months ago • 1 comments

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?

yvesInnofactory avatar Aug 20 '25 09:08 yvesInnofactory

Hello

In upcoming version 5.2, you will be able to replace a text with a list.

Evance Developer

Evance-XceedDev avatar Oct 24 '25 02:10 Evance-XceedDev