We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

I have a string, which will be inserted into a word file

Thread ID:

Created:

Updated:

Platform:

Replies:

126081 Sep 22,2016 11:40 AM UTC Sep 28,2016 05:38 AM UTC ASP.NET MVC 4
loading
Tags: DocIO
mvxyc
Asked On September 22, 2016 11:40 AM UTC

I have a string(which is inside a solution/DLL which does not have syncfusion's DLLs), and I will insert that string into a word file(later in a project with syncfusions dlls included).

Project without Syncfusion:
string bla="Text some text"+Environment.NewLine+"more text"+Environment.NewLine;

Project with Syncfusion, inserted into a word file that string, but I get no line breaks.

How ?


Priyanga Elangovan [Syncfusion]
Replied On September 23, 2016 09:01 AM UTC

Hi Customer,

Thank you for contacting Syncfusion support.

DocIO provides support to insert a linebreak to the paragraph using AppendBreak API. For your reference please find the following code snippet.


 
//Loads the template document
WordDocument wordDocument = new WordDocument();
wordDocument.EnsureMinimal();
//Adds the paragraph to the document
WParagraph paragarph = wordDocument.LastSection.AddParagraph() as WParagraph;
//Appends the text to the paragraph
paragarph.AppendText(
"Text some text");
//Appends the line break
paragarph.AppendBreak(
BreakType.LineBreak);
//Appends the text to the paragraph
paragarph.AppendText(
"more text");
//Appends the line break
paragarph.AppendBreak(
BreakType.LineBreak);
//Saves the document
wordDocument.Save(
"output.docx");
wordDocument.Close();
 

Regards,
Priyanga.E
 


Priyanga Elangovan [Syncfusion]
Replied On September 23, 2016 09:52 AM UTC

Hi Customer,

Kindly ignore our previous update.

Regarding “
string bla="Text some text"+Environment.NewLine+"more text"+Environment.NewLine”:
As per Microsoft Word behaviour, the functionality of Environment.NewLine character is to split the content as new paragraph and DocIO does the same.

Kindly use the AppendBreak API to insert the line break to the paragraph. For your reference please find the following code snippet.
 
//Loads the template document
WordDocument wordDocument = new WordDocument();
wordDocument.EnsureMinimal();
//Adds the paragraph to the document
WParagraph paragarph = wordDocument.LastSection.AddParagraph() as WParagraph;
//Appends the text to the paragraph
paragarph.AppendText(
"Text some text");
//Appends the line break
paragarph.AppendBreak(
BreakType.LineBreak);
//Appends the text to the paragraph
paragarph.AppendText(
"more text");
//Appends the line break
paragarph.AppendBreak(
BreakType.LineBreak);
//Saves the document
wordDocument.Save(
"output.docx");
wordDocument.Close();
 
 

Regards,
Priyanga.E
 


  


Testname
Replied On September 27, 2016 07:08 AM UTC

The problem at this point is, that I do not have any syncfusion library.

Sethumanikkam Yogendran [Syncfusion]
Replied On September 28, 2016 05:38 AM UTC

Hi Customer,

Thank you for your update.

You can download the latest version Essential studio 14.2.0.32 service pack from below link.
https://www.syncfusion.com/forums/125638/essential-studio-2016-volume-2-service-pack-release-v14-2-0-32-available-for-download

Please refer the below link to know more about release announcements.
https://www.syncfusion.com/forums/announcements

Please refer the below link to know more about assemblies required for DocIO.
https://help.syncfusion.com/file-formats/docio/assemblies-required

You may also contact salessupport@syncfusion.com for further clarification.

Please let us know if you have any other questions.

Thanks,
Sethumanikkam.Y
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;