convert line breaks into internal ppt represenatation when changing text
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@656252 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c0e0729da0
commit
8cd5e9d411
@ -37,6 +37,7 @@
|
||||
|
||||
<!-- Don't forget to update status.xml too! -->
|
||||
<release version="3.1-beta2" date="2008-05-??">
|
||||
<action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use empty string instead of null when the length is zero.</action>
|
||||
|
@ -34,6 +34,7 @@
|
||||
<!-- Don't forget to update changes.xml too! -->
|
||||
<changes>
|
||||
<release version="3.1-beta2" date="2008-05-??">
|
||||
<action dev="POI-DEVELOPERS" type="fix">44985 - Properly update TextSpecInfoAtom when the parent text is changed</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">41187 - fixed HSSFSheet to properly read xls files without ROW records</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">44950 - fixed HSSFFormulaEvaluator.evaluateInCell() and Area3DEval.getValue() also added validation for number of elements in AreaEvals</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">42570 - fixed LabelRecord to use empty string instead of null when the length is zero.</action>
|
||||
|
@ -37,14 +37,14 @@ where $TAG is the release tag, for example, REL_3_1_BETA1
|
||||
3. Checkout the tagged version
|
||||
{code}
|
||||
cd tags
|
||||
svn checkout https://svn.apache.org/repos/asf/poi/tags/TAG
|
||||
svn checkout https://svn.apache.org/repos/asf/poi/tags/$TAG
|
||||
{code}
|
||||
|
||||
4. Merge (if required)
|
||||
|
||||
{code}
|
||||
cd $TAG
|
||||
$ svn merge https://svn.apache.org/repos/asf/poi/tags/TAG \
|
||||
$ svn merge https://svn.apache.org/repos/asf/poi/tags/$TAG \
|
||||
https://svn.apache.org/repos/asf/poi/trunk
|
||||
{code}
|
||||
|
||||
|
@ -318,9 +318,9 @@ public class TextRun
|
||||
* touch the stylings.
|
||||
*/
|
||||
private void storeText(String s) {
|
||||
// Remove a single trailing \n, as there is an implicit one at the
|
||||
// Remove a single trailing \r, as there is an implicit one at the
|
||||
// end of every record
|
||||
if(s.endsWith("\n")) {
|
||||
if(s.endsWith("\r")) {
|
||||
s = s.substring(0, s.length()-1);
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ public class TextRun
|
||||
* as the the first character has.
|
||||
* If you care about styling, do setText on a RichTextRun instead
|
||||
*/
|
||||
public synchronized void setText(String s) {
|
||||
public synchronized void setRawText(String s) {
|
||||
// Save the new text to the atoms
|
||||
storeText(s);
|
||||
RichTextRun fst = _rtRuns[0];
|
||||
@ -487,7 +487,16 @@ public class TextRun
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Changes the text.
|
||||
* Converts '\r' into '\n'
|
||||
*/
|
||||
public synchronized void setText(String s) {
|
||||
String text = normalize(s);
|
||||
setRawText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure a StyleTextPropAtom is present for this run,
|
||||
* by adding if required. Normally for internal TextRun use.
|
||||
*/
|
||||
@ -666,4 +675,12 @@ public class TextRun
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new string with line breaks converted into internal ppt representation
|
||||
*/
|
||||
public String normalize(String s){
|
||||
String ns = s.replaceAll("\\r?\\n", "\r");
|
||||
return ns;
|
||||
}
|
||||
}
|
||||
|
@ -162,10 +162,18 @@ public class RichTextRun {
|
||||
* Change the text
|
||||
*/
|
||||
public void setText(String text) {
|
||||
length = text.length();
|
||||
parentRun.changeTextInRichTextRun(this,text);
|
||||
String s = parentRun.normalize(text);
|
||||
setRawText(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the text
|
||||
*/
|
||||
public void setRawText(String text) {
|
||||
length = text.length();
|
||||
parentRun.changeTextInRichTextRun(this,text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the RichTextRun its new position in the parent TextRun
|
||||
* @param startAt
|
||||
|
Loading…
Reference in New Issue
Block a user