Skip to content

Commit

Permalink
Merge pull request #3 from happy-doc/HDD-1443-Export-ready-fields-wit…
Browse files Browse the repository at this point in the history
…h-indents

Hdd-1443 export ready fields with indents
  • Loading branch information
jack-happydoc authored Jan 14, 2025
2 parents 6cd3a3a + 0c8367d commit 75e20c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Format.prototype.updateTables = function(colorTable, fontTable){

//some RTF elements require that they are wrapped, closed by a trailing 0 and must have a spacebefore the text.
function wrap(text, rtfwrapper){
return rtfwrapper + " " + text + rtfwrapper + "0";
return rtfwrapper + text + rtfwrapper + "0";
}

/**
Expand All @@ -93,7 +93,9 @@ Format.prototype.formatText = function(text, colorTable, fontTable, safeText){
if(this.rightIndent>0) rtf += "\\ri" + this.rightIndent.toString();

//we don't escape text if there are other elements in it, so set a flag
var content = "";
//ensure that there is a space between the control character and the text
//otherwise things won't render properly
var content = " ";
if(safeText === undefined || safeText){
content += Utils.getRTFSafeText(text);
}else{
Expand All @@ -112,7 +114,7 @@ Format.prototype.formatText = function(text, colorTable, fontTable, safeText){
if(this.makeParagraph) rtf += "\\par";

//close doc
rtf+="}";
rtf+="}\n";

return rtf;
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "@happy-doc/rtf",
"version" : "0.0.2",
"version" : "0.0.3",
"description" : "Assists with creating rich text documents.",
"main" : "./lib/rtf.js",
"author" : "HappyDoc",
Expand Down

0 comments on commit 75e20c4

Please sign in to comment.