I need to make a bulleted list in word. It gets the input from a Multi-Line text box. Each new line that is started on the multt-line text box should produce a new bullet point.
Here is an example of what I am trying to achieve:
Here is the code that I have, which generates text that was already inputted. (BTW it is not mine)
Paragraph assets = doc.Content.Paragraphs.Add();
assets.Range.ListFormat.ApplyBulletDefault();
string[] bulletItems = new string[] { "One", "Two", "Three" };
for (int i = 0; i < bulletItems.Length; i++)
{
string bulletItem = bulletItems[i];
if (i < bulletItems.Length - 1)
bulletItem = bulletItem + "\n";
assets.Range.InsertBefore(bulletItem);
}
I'm not exactly what you're trying to achieve, but as I understand it you're trying to insert bullets before each line in a TextBox and then trying to put that text into Word?
Maybe this snippet of code will help you.
string[] unbulleted = textBox1.Lines;
string[] bulleted = new string[unbulleted.Length];
for (int i = 0; i < bulleted.Length; i++)
bulleted[i] = "\u2022" + unbulleted[i];
So now you have a string[] with bullets before each string! I'm not sure how one inserts it into Word though.