Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ReplaceTextWithObject does not work with List

Open
#488 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
tooling

Research direction

Start at document.ReplaceTextWithObject and ObjectReplaceTextOptions, then compare the supported object types named in the runtime exception with the List and bulletList construction shown in the report. Determine the intended behavior for replacing placeholder text with a bullet list; done means the replacement works without the unknown-object exception and preserves the list items.

Written by the indexing model from the issue text.

Description

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?

Dominant language
C#
Stars
1.9k
Forks
483
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xceedsoftware/DocX

All issues in xceedsoftware/DocX

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.