Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/MiniWord/MiniWord.Implment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ private static void AvoidSplitTagText(OpenXmlElement xmlElement)
sb.Append(text.InnerText);
pool.Add(text);

var s = sb.ToString().TrimStart(); //TODO:
var rawText = sb.ToString();
var s = rawText.TrimStart();

// TODO: check tag exist
// TODO: record tag text if without tag then system need to clear them
// TODO: every {{tag}} one <t>for them</t> and add text before first text and copy first one and remove {{, tagname, }}
Expand All @@ -288,7 +290,11 @@ private static void AvoidSplitTagText(OpenXmlElement xmlElement)
{
var first = pool.First();
var newText = first.Clone() as Text;
newText.Text = s;
newText.Text = rawText;
if (char.IsWhiteSpace(rawText[0]) || char.IsWhiteSpace(rawText[rawText.Length - 1]))
{
newText.Space = SpaceProcessingModeValues.Preserve;
}
first.Parent.InsertBefore(newText, first);
foreach (var t in pool)
{
Expand Down