TextDecoration

Hi,

This is what I am trying to do, I would appreciate it if you could show me the simplest way to do so.

I want to add some text decoration to a c# string, add that string to a table, then add the table to my Aspose document to do Mailmerge on.

How can I do that? If your answer is using DocumentBuilder please provide some information as how to use it.

Many thanks,
Reza

@rezakaj,

Thanks for your inquiry. Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.

HERE IS AN EXAMPLE:
1- This could be a different formatting and the following is underlined.
2- Whatever text could go here.

Well I can’t really apply formatting here but you get the idea.
The title is BOLD and all capital, some of the first line is underlined.

Many thanks,
Reza

@rezakaj,

Thanks for sharing the detail. Please refer to the following articles and check the following code example. Hope this helps you.
Specifying Formatting
Use DocumentBuilder to Insert Document Elements

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);
builder.Font.Bold = true;
builder.Font.Italic = true;
builder.Write("THIS TEXT IS BOLD AND ITALIC");

//Resets to default font formatting. 
builder.Font.ClearFormatting();
builder.Font.Underline = Underline.Single;
builder.Write(" Some more text with underline formatting.");

builder.Font.ClearFormatting();

//Insert the paragraph break;
builder.Writeln();

builder.Write("Please make sure to visit ");

// Specify font formatting for the hyperlink.
builder.Font.Color = Color.Blue;
builder.Font.Underline = Underline.Single;
// Insert the link.
builder.InsertHyperlink("Aspose Website", "http://www.aspose.com", false);

// Revert to default formatting.
builder.Font.ClearFormatting();

builder.Write(" for more information.");

builder.Writeln();
builder.Font.Border.Color = System.Drawing.Color.Green;
builder.Font.Border.LineWidth = 2.5;
builder.Font.Border.LineStyle = LineStyle.DashDotStroker;

builder.Write("run of text in a green border");

doc.Save(MyDir + "output.docx");

Thank you for your reply,
My problem is that at the point that I am manipulating this string I don’t have the Aspose Document generated yet. That will happen in another method.
So I am putting this string in a table and pass the table as a part of an object that consists of multiple tables to MailMerge.ExecuteWithRegions later on.
So in your code you are creating a DocumentBuilder attached to the 'doc; that does not exist in my code.
Any suggestions are welcome at this point.
Thanks,
Reza

@rezakaj,

Thanks for your inquiry. Unfortunately, your question isn’t clear enough therefore we request you to please elaborate your inquiry further. Also, please supply input, output and expected output documents and your current code example. This will help us to understand your scenario, and we will be in a better position to address your concerns accordingly.