[Modified] break character KO - Tabulation OK


#1

No [N] UPDATED [SEE LAST POST] No [N]

I just Update my version of Aspose.PowerPoint and I found now a bug:

I try to insert a tabulation into a Portion an I get an error:

Source:
myParagraphs[ y ].Portions[ x ].Text = "\tTitle";

Error:
Can't assign string which contains paragraph break character

How can I keep my \t ???
Thanks for your answer


#2

That is not possible.

Such exception can be thrown only if “\n” or “\r” found in the string.


#3

But It was perfect with the version 2.3.5
Angry [:@] Now I cannot generate document from the users data.

Ok it great to have write for texteframe.text but it was perfectly working before.

Could you provide me more information and other way to obtain same result as before because I must downgrade my Aspose.PowerPoint version Crying [:'(]

Thanks for help


#4

Hi,

I just made some more tests with ASPOSE.PowerPoint v3.5.7.0

1/ About "\t"
In fact "\t" works, I have done more test and when I try to insert a "\t" into a portion, it works.
pres.Slides[0].Shapes[0].TextFrame.Paragraphs[0].Portions[0].Text = "# \t # \t #"; > OK

2/ About "\r" & "\n" & "\r\n"
Was perfectly working with ASPOSE.PowerPoint v2.3.5
pres.Slides[0].Shapes[0].TextFrame.Paragraphs[0].Portions[0].Text = "# \n #"; > KO

In debug or Release it provides an exception.
It's meaning that for each time I have a "\r\n" I need to insert a new paragraphs, hard work.
aspose.PowerPoint cannot do it itself ???

3/ Could you told me HOW I can insert a new line without a new paragraph ? You know like "SHIFT + ENTER" used in powerpoint document ????


#5

Hello Mach!

You can insert soft line break using ‘\v’ character.


#6

Please check this thread, it contains attached code at the end

http://www.aspose.com/Community/Forums/40800/ShowPost.aspx



We don’t provide automatic inserting string with carriage returns for better flexibility.

You can find my explanations why we disabled it in 2.3.6 in this forum.

Simple string parsing will take not more than 10 lines of code.



string sometext = “#\n#”;

Paragraphs paras = pres.Slides[0].Shapes[0].TextFrame.Paragraphs;



char[] delimiters = new char[] {’\r’, ‘\n’};

string[] split = sometext.Split(delimiters);

paras[0].Portions[0].Text = split[0];

for (int i = 1; i < split.Length; i++) {

paras.Insert(i, new Paragraph(paras[i - 1]));

paras[ i ].Portions.Clear();

paras[ i ].Portions.Add(new Portion(paras[0].Portions[0]));

paras[ i ].Portions[0].Text = split[ i ];

}



Hard work. Isn’t it?


#7

Sure, it's not a Hard Work,
But in my case the generation core isn't as easy, and it's not a easy work to adapt it.

Doesn't matter. I will try to match "\r\n" with "\v"

Thanks