B2020-061: Crash when importing table with RO as first text in cell with changed font size

This commit is contained in:
Kathy Ruffing 2020-05-22 12:45:34 +00:00
parent c266192519
commit c97cdfa0d5

View File

@ -388,9 +388,16 @@ namespace VEPROMS.CSLA.Library
} }
private string GetMyPrefix(int start, int lastIndex) private string GetMyPrefix(int start, int lastIndex)
{ {
string defPrefix = Text.Substring(start - 3, 3); // B2020-061: Remove font size rtf command before looking for prefix
string tText = Text;
if (tText.Contains(@"\fs"))
{
tText = Regex.Replace(tText, @"\\v\\fs[0-9]+ ", "\\v ");
start = tText.IndexOf("<START]");
}
string defPrefix = tText.Substring(start - 3, 3);
if (defPrefix != @"\v ") throw new Exception(string.Format("rtf string {0} does not match expected format", defPrefix)); if (defPrefix != @"\v ") throw new Exception(string.Format("rtf string {0} does not match expected format", defPrefix));
string txt = Text.Substring(lastIndex, start - lastIndex - 3); string txt = tText.Substring(lastIndex, start - lastIndex - 3);
int lastSlash = txt.LastIndexOf(@"\"); int lastSlash = txt.LastIndexOf(@"\");
int lastSpace = txt.LastIndexOf(" "); int lastSpace = txt.LastIndexOf(" ");
int lastCR = txt.LastIndexOf("\r"); int lastCR = txt.LastIndexOf("\r");