Working with Shape Text


#1

I need to remove carriage returns from a text frame and then have the data concise on both sides. Any suggestions?


#2
zekuczynski wrote:
I need to remove carriage returns from a text frame and then have the data concise on both sides. Any suggestions?

        private void RemoveLinebreaksFromTextFrame(TextFrame textFrame)
{
if(textFrame.Paragraphs.Count == 0)
return;
// merging paragraphs
for(int i = 1; i < textFrame.Paragraphs.Count; i++)
foreach(Portion p in textFrame.Paragraphs[ i ].Portions)
textFrame.Paragraphs[ 0 ].Portions.Add( p );
while(textFrame.Paragraphs.Count > 1)
textFrame.Paragraphs.RemoveAt( 1 );
// removing soft line breaks
foreach(Portion portion in textFrame.Paragraphs[ 0 ].Portions)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for(int i = 0; i < portion.Text.Length; i++)
{
if(portion.Text[ i ] != '\v')
sb.Append(portion.Text[ i ]);
}
portion.Text = sb.ToString();
}
}