How to Make Multiple Bullet Columns in Microsoft Word using DocIO

Hello,
I have a list of string having seven strings.  How do I split the  list of strings into two bullet columns, one having 4 string and another 3 string and show it in Microsoft Word using DocIO.

If I have list of strings less or equal to 4 , I want to show one bullet column of list and if greater than 4 show 2  bullet columns.

In Microsoft Word , its possible. Please see url below. How do I do it using DocIO?


A sample example will be helpful

Thanks

11 Replies

MR Manikandan Ravichandran Syncfusion Team March 16, 2020 12:53 PM UTC

Hi Robin,

Thanks for being patience.

We are working with high priority of your query, we will update you the further details shortly

Regards,
Manikandan Ravichandran



MR Manikandan Ravichandran Syncfusion Team March 16, 2020 07:21 PM UTC

Hi Robin,

Thank you for your patience.

For your requirement, we have prepared the sample and attached to itself. It can be downloaded from the following link.
https://www.syncfusion.com/downloads/support/forum/152430/ze/ASPNetMVC_(3)-341995768

In this sample we done the followings.
1. Created a new Word document instance.
2. Added one section and one paragraph with some text.
3. Added another section with 2 columns
4. Added string list with bullet points in both columns.
5. Added another section at the end of columns.
6. Saved and closed the word document instance.

To know more about multicolumn section and list numbering, please refer the following links.
https://help.syncfusion.com/file-formats/docio/working-with-sections#creating-multi-column-document
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#working-with-lists

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran



RK Robin Knight replied to Manikandan Ravichandran March 17, 2020 12:47 AM UTC

Hi Robin,

Thank you for your patience.

For your requirement, we have prepared the sample and attached to itself. It can be downloaded from the following link.
https://www.syncfusion.com/downloads/support/forum/152430/ze/ASPNetMVC_(3)-341995768

In this sample we done the followings.
1. Created a new Word document instance.
2. Added one section and one paragraph with some text.
3. Added another section with 2 columns
4. Added string list with bullet points in both columns.
5. Added another section at the end of columns.
6. Saved and closed the word document instance.

To know more about multicolumn section and list numbering, please refer the following links.
https://help.syncfusion.com/file-formats/docio/working-with-sections#creating-multi-column-document
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#working-with-lists

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran


Thank you for your sample project. However have few issues

1)  The  data has long words e.g. Local Aid Programs Office/Division.  The list is wrapping the word into  next line. How do I avoid this and show the data on the same line

2) The data has two lists. Please provide a sample project with looping through the list and showing the multi  bullet columns

 Please see sample report for the data

Thanks,


List 1

  •  Design
  •  Districts/Regions
  • Local Aid Programs Office/Division
  • Maintenance

 List 2

  •  Operations
  • Planning
  • Traffic Engineering/Safety

 

 


·                Operations

·                Planning

·                Traffic Engineering/Safety





Attachment: Report_3ec4691e.zip


MR Manikandan Ravichandran Syncfusion Team March 17, 2020 04:18 PM UTC

Hi Robin,

Thank you for your update.

Reg - The list is wrapping the word into  next line. How do I avoid this and show the data on the same line?
When we divide the section in to two columns with equal position, the limited length of text only allows to fit in the column. If the text length exists the column width, then it moves to next line. If you want to set the text in same line means, we suggest to adjust the column width based on the text length as like below.

 
//Adds the first column into the section
section.AddColumn(270, 5);
//Adds the second column into the section
section.AddColumn(230, 5); 

Reg - Please provide a sample project with looping through the list and showing the multi bullet columns
As per your request, we have prepared the sample and attached to itself. It can be downloaded from the following link.
https://www.syncfusion.com/downloads/support/forum/152430/ze/ASPNetMVC-1028328587

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran



RK Robin Knight March 17, 2020 11:12 PM UTC

I implemented your recommendation but that did not work.

section.AddColumn(270, 5);
//Adds the second column into the section
section.AddColumn(230, 5); 

Also your latest sample project  sounds like it is old project you send 

Project  in 

AND


What I want is 
The data has two lists. Please provide a sample project with looping through the list and showing the multi  bullet columns

List 1

  •  Design
  •  Districts/Regions
  • Local Aid Programs Office/Division
  • Maintenance

 List 2

  •  Operations
  • Planning
  • Traffic Engineering/Safety





MR Manikandan Ravichandran Syncfusion Team March 18, 2020 03:12 PM UTC

Hi Robin,

Thank you for your update.

Reg - I implemented your recommendation but that did not work.
As mentioned earlier, the text length exists the column width, then it moves to next line.
Whereas Essential DocIO is a non-UI component that provides a full-fledged document object model to manipulate the Word document contents. Hence it is not feasible to adjust the column width based on the text width dynamically.

Reg - Also your latest sample project sounds like it is old project you send
In the previously provided sample, we have 2 list, and each is appended in each column based on the requirement. Please refer the code example which is used in the provided sample for append list string in 2 columns.

 
for (int i = 0; i < list1.Count; i++)
{
      
//Adds new paragraph to the section
       paragraph = section.AddParagraph();
      
//Applies default numbered list style
       paragraph.ListFormat.ApplyDefBulletStyle();
      
//Adds text to the paragraph
       paragraph.AppendText(list1[i]);
      
//Continues the list defined
       paragraph.ListFormat.ContinueListNumbering();
}
paragraph = section.AddParagraph();
paragraph.AppendBreak(BreakType.ColumnBreak);
for (int j = 0; j < list2.Count; j++)
{
       paragraph = section.AddParagraph();
      
//Applies default numbered list style
       paragraph.ListFormat.ApplyDefBulletStyle();
      
//Adds text to the paragraph
       paragraph.AppendText(list2[j]);
      
//Continues the list defined
       paragraph.ListFormat.ContinueListNumbering();
}
section = document.AddSection();
section.BreakCode = SectionBreakCode.NoBreak;
 

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran



RK Robin Knight March 20, 2020 01:22 AM UTC

Thank you for the sample project. I have another problem.

I have a large word document report and am using Table of Contents (TOC). When I implement  the multi column list with bullets code  and in the end  use
document.UpdateTableOfContents(); it does not seem to update table of contents .

Please provide  a sample project containing Table of contents with multiple section. Each section will have a paragraph and each paragraph will implement multi column list with bullet and in the end update table of contents

Thanks


MR Manikandan Ravichandran Syncfusion Team March 20, 2020 02:10 PM UTC

Hi Robin,

Thank you for your update.

As per your request, we have prepared the sample and attached to itself. It can be downloaded from the following link.
https://www.syncfusion.com/downloads/support/forum/152430/ze/ASPNetMVC1558438991

In this sample, we have done the followings.
1. Created the word document.
2. Added a new section with paragraph.
3. Append Table of content (TOC) field in the section.
4. Added another section and new paragraph.
5. Added new Text with header style and added multi-level list in this section.
6. Added another section and added new text with header style.
7. Added table in this section.
8. Added another section and added new text with header style.
9. Added some shapes in this section.
10. Finally updated the Table of content using “
UpdateTableOfContents” API.
11. Saved and closed the document instance.

Please refer the following UG link to know more about Table of content.
https://help.syncfusion.com/file-formats/docio/working-with-table-of-contents

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran



RK Robin Knight March 21, 2020 04:15 PM UTC

Thank you for the sample project. I saw the sample report generated by your project. IT has TOC but it has Heading1.  Each new section gets added to new page.

Please find attached my sample report and its table of contents. It has  Heading 1 and Heading 2.

Go to Question 7, When I implement your sample code, the multi column bullet list goes to the end after "Program Methodology". It should show after Question 7. 

Please see sample code I am using.. In the code , if the finalList count is less then 4 , I am showing single column bullet list (Question 5)  If  the finalList count is greater then 4 i.e else part  I am trying to use multi column bullet list code which  shows the bullet list at the end.

I would  to show the multicolumn bullet list in Question 7 & Question 9

A sample project showing the Report with multi column bullet list at Q7 & Q9 will be helpful.

 if (finalList.Count <= 4)
            {
               
               // section = document.AddSection();
                IWParagraph singleParagraph = section.AddParagraph();
                section.BreakCode = SectionBreakCode.NoBreak;

                section.AddColumn(250, 5);
                //Adds the column into the section
             //   section.AddColumn(250, 5);
                //Adds the column into the section    
                section.MakeColumnsEqual();

                for (int i = 0; i < finalList.Count; i++)
                {
                    singleParagraph = section.AddParagraph();
                    singleParagraph.ListFormat.ApplyDefBulletStyle();
                    singleParagraph.AppendText(finalList[i].ToString());
                    singleParagraph.ListFormat.ContinueListNumbering();
                   
                }

             //   singleParagraph = section.AddParagraph();
             //   singleParagraph.AppendBreak(BreakType.ColumnBreak);
             //   section = document.AddSection();
            //   section.BreakCode = SectionBreakCode.NoBreak;

            }
            else
            {

                List<List<string>> splitLists = ReportUtility.SplitLists(finalList, 4);
                List<string> list1 = splitLists[0];
                List<string> list2 = splitLists[1];

                section = document.AddSection();
                IWParagraph multipleParagraph = section.AddParagraph();
               section.BreakCode = SectionBreakCode.NoBreak;
                //Adds the column into the section
                section.AddColumn(250, 5);
                //Adds the column into the section
                section.AddColumn(250, 5);
                //Adds the column into the section    
                section.MakeColumnsEqual();


                for (int i = 0; i < list1.Count; i++)
                {
                    multipleParagraph = section.AddParagraph();
                    multipleParagraph.ListFormat.ApplyDefBulletStyle();
                    multipleParagraph.AppendText(list1[i].ToString());
                    multipleParagraph.ListFormat.ContinueListNumbering();
                  

                }
               multipleParagraph = section.AddParagraph();
               multipleParagraph.AppendBreak(BreakType.ColumnBreak);
               

                for (int i = 0; i < list2.Count; i++)
                {
                    multipleParagraph = section.AddParagraph();
                    multipleParagraph.ListFormat.ApplyDefBulletStyle();
                    multipleParagraph.AppendText(list2[i].ToString());
                    multipleParagraph.ListFormat.ContinueListNumbering();
                  

                }
             

                  section = document.AddSection();
                  section.BreakCode = SectionBreakCode.NoBreak;

            }


Attachment: Report_03212020120811_89320210.zip


RK Robin Knight March 22, 2020 07:15 PM UTC

Another question: Is it possible to show multi column bullet list with  section.AddParagraph().AppendHTML using  the example on the url below


Please provide sample example 

Thanks


MR Manikandan Ravichandran Syncfusion Team March 24, 2020 07:52 PM UTC

Hi Robin,

Thank you for your update.

Reg - Is it possible to show multi column bullet list with section.AddParagraph().AppendHTML
Essential DocIO have limited css support for HTML conversion. So, we unable to create multiple column with AppendHTML API. As a workaround solution, please use the following code example to achieve your requirement.

 
WordDocument document = new WordDocument();
//Adds the section into Word document
IWSection section = document.AddSection();
IWParagraph paragraph = section.AddParagraph();
section.BreakCode = SectionBreakCode.NoBreak;
//Adds the column into the section
section.AddColumn(250, 5);
//Adds the column into the section
section.AddColumn(250, 5);
paragraph = section.AddParagraph();
paragraph.AppendHTML(
"<div><ul><li>Left Item 1</li><li>Left Item 2</li><li>Left Item 3</li><li>Left Item 4</li><li>Left Item 5</li></ul></div>");
paragraph = section.AddParagraph();
paragraph.AppendBreak(BreakType.ColumnBreak);
paragraph = section.AddParagraph();
paragraph.AppendHTML(
"<div><ul><li>Right Item 1</li><li>Right Item 2</li><li>Right Item 3</li><li>Right Item 4</li><li>Right Item 5</li></ul></div>");
section = document.AddSection();
section.BreakCode = SectionBreakCode.NoBreak;
document.Save(
"Output.docx");
document.Close();
 

Reg - Go to Question 7, When I implement your sample code, the multi column bullet list goes to the end after "Program Methodology". It should show after Question 7.
To append multi column list under each question in the document, then separate each question with section continues break in the word document and the questions in which multi column list going to append. Then insert the new section with multi column after the section which have questions. Thereby, we can achieve your requirement. Based on this, we have prepared the sample and attached to itself. It can be downloaded from the following link.
https://www.syncfusion.com/downloads/support/forum/152430/ze/ASPNetMVC168139808

If you think, we misunderstood any of your requirement, then kindly provide us modified sample of the above or complete runnable sample along with input template Word document, screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution at the earliest.

Please let us know if you have any other questions.

Regards,
Manikandan Ravichandran



Loader.
Up arrow icon