合并后颜色表可能失效,可预先在第一个文件中生成所有用到的颜色解决。
private static string CombineRtf(string rtf1, string rtf2) { rtf1 = rtf1.Trim(); rtf2 = rtf2.Trim(); rtf1 = rtf1.Substring(0, rtf1.Length - 1); // rtf1去除尾部 "}" List<string> list2 = rtf2.Split('\n').ToList(); list2.RemoveAt(0); list2.RemoveAt(0); // rtf2去除前两行描述头 return $"{rtf1}\\par\\par\\par\\par\n{string.Join("\n", list2.ToArray())}\\0";