Fixed logic to support text library documents

A couple more fixes to paste dashes from Adobe
This commit is contained in:
Rich 2012-12-06 21:29:55 +00:00
parent fd983f616c
commit 414378e0f3
2 changed files with 36 additions and 25 deletions

View File

@ -162,6 +162,8 @@ namespace DataLoader
private void LoadAndSaveRichTextBox41(string tmpName) private void LoadAndSaveRichTextBox41(string tmpName)
{ {
string rtf = LoadFileRaw(tmpName); string rtf = LoadFileRaw(tmpName);
if (rtf.StartsWith(@"{\rtf"))
{
rtf = StripTokensFromFontTable(rtf); rtf = StripTokensFromFontTable(rtf);
// Parse for margins because the RTB will remove them // Parse for margins because the RTB will remove them
rtf = rtf.Replace("\x95", @"\bullet ");// Bullet rtf = rtf.Replace("\x95", @"\bullet ");// Bullet
@ -186,7 +188,12 @@ namespace DataLoader
rtf = MyRichTextBox41.Rtf; // Get the RTF back from the RichTextBox rtf = MyRichTextBox41.Rtf; // Get the RTF back from the RichTextBox
// Add the margins to the RTB output // Add the margins to the RTB output
rtf = Regex.Replace(rtf, @"\\ansi(?=[ \\{])", @"\ansi" + match.Value); rtf = Regex.Replace(rtf, @"\\ansi(?=[ \\{])", @"\ansi" + match.Value);
// Save the modified rtf to the temporary file }
else
{
MyRichTextBox41.Text = rtf;
rtf = MyRichTextBox41.Rtf;
}
SaveFile(rtf, tmpName); SaveFile(rtf, tmpName);
} }
private string _Prefix; private string _Prefix;

View File

@ -1067,6 +1067,10 @@ namespace Volian.Controls.Library
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> "); tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 <NewID> "); tmpForLink = Regex.Replace(tmpForLink, @"#Link:Transition:([0-9]+) [0-9]+ ", @"#Link:Transition:$1 <NewID> ");
tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 <NewID> "); tmpForLink = Regex.Replace(tmpForLink, @"#Link:TransitionRange:([0-9]+) [0-9]+ ", @"#Link:TransitionRange:$1 <NewID> ");
tmpForLink = tmpForLink.Replace(@"\u8212 \'96", @"-"); // Replace EM Dash with hyphen
tmpForLink = tmpForLink.Replace(@"\u8211 \'96", @"-"); // Replace EN Dash with hyphen
tmpForLink = tmpForLink.Replace(@"\u8212 ", @"-"); // Replace EM Dash with hyphen
tmpForLink = tmpForLink.Replace(@"\u8211 ", @"-"); // Replace EN Dash with hyphen
myRtb.SelectedRtf = tmpForLink; myRtb.SelectedRtf = tmpForLink;
} }
else if (myDO.GetDataPresent(DataFormats.Text)) else if (myDO.GetDataPresent(DataFormats.Text))