Here's a C # function that takes a string, splits it into line breaks, and displays it in OpenXML. To use, create an instance of Run and pass it to a function with a string.
void parseTextForOpenXML( Run run, string textualData ) { string[ ] newLineArray = { Environment.NewLine }; string[ ] textArray = textualData.Split( newLineArray, StringSplitOptions.None ); bool first = true; foreach ( string line in textArray ) { if ( ! first ) { run.Append( new Break( ) ); } first = false; Text txt = new Text( ); txt.Text = line; run.Append( txt ); }
Toolsmythe Oct 07 2018-11-22T00: 00Z
source share