Does Aspose.Words for .NET with LINQ Reporting Engine support Bullet List in a variable?

Hi Support,

We use LINQ Engine to inject data into word templates and we want to generate MS Word Bulleted List automatically if a variable contains a list.
Are there solutions to achieve that ? Maybe if the initial variable is formatted with markdown syntax ?

Word Template:

<<[MyList]>>

C# Code:

string myVariable = @"Random text rendering before
My list:
* Item 1
* Item 2
* Item 3

Random text rendering after";
var document = new Document(templateStream);
var builder = new DocumentBuilder(wordDocument);
var engine = new ReportingEngine();
engine.BuildReport(document, myVariable, "MyList");
builder.Document.Save(filepath, Aspose.Words.SaveFormat.Docx);

Under “My list”, it should render a bulleted list with my 3 items

Thanks,
Romain

@Romain602

It is possible to make a variable contain HTML markup as follows:

string myVariable = @"<p>Random text rendering before</p>
<p>My list:</p>
<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>
<p>Random text rendering after</p>";

Then, you can use the following template for your scenario:

<<[MyList] -html>>

In case myVariable does not contain HTML markup, the value is just outputted as is. See Outputting Expression Results for more information.

Regarding usage of markdown, it is also possible with help of a doc tag. However, please note that a doc tag accepts a value of one of the following types:

  • A byte array containing document data
  • A Stream instance able to read document data
  • An instance of the Document class
  • A string containing a document URI, path, or Base64-encoded document data

So, if you prefer this option, then your markdown content should be transformed to one of the abovementioned types, for example, by using Encoding.UTF8.GetBytes(myVariable). See Inserting Documents Dynamically for more information.

1 Like