From 06787c0392eff506d1cc508057d010e473e7927b Mon Sep 17 00:00:00 2001 From: AJ Date: Tue, 20 Aug 2019 07:52:36 -0400 Subject: [PATCH] Remove font xml from description --- ExportDXF/Forms/MainForm.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ExportDXF/Forms/MainForm.cs b/ExportDXF/Forms/MainForm.cs index 6cf5617..62cd3c7 100644 --- a/ExportDXF/Forms/MainForm.cs +++ b/ExportDXF/Forms/MainForm.cs @@ -7,6 +7,7 @@ using System.ComponentModel; using System.Drawing; using System.IO; using System.Linq; +using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; @@ -352,6 +353,8 @@ namespace ExportDXF.Forms if (item.Description == null) item.Description = model.Extension.CustomPropertyManager[""].Get("Description"); + item.Description = RemoveFontXml(item.Description); + var db = string.Empty; item.Material = part.GetMaterialPropertyName2(config, out db); @@ -380,6 +383,24 @@ namespace ExportDXF.Forms } } + private string RemoveFontXml(string s) + { + if (s == null) + return null; + + var fontXmlRegex = new Regex(""); + var matches = fontXmlRegex.Matches(s) + .Cast() + .OrderByDescending(m => m.Index); + + foreach (var match in matches) + { + s = s.Remove(match.Index, match.Length); + } + + return s; + } + private string GetFileName(Item item) { var prefix = prefixTextBox.Text.Replace("\"", "''"); @@ -588,9 +609,7 @@ namespace ExportDXF.Forms private List GetItems(BomTableAnnotation bom) { var items = new List(); - var table = bom as TableAnnotation; - var itemNoColumnIndex = table.IndexOfColumnType(swTableColumnTypes_e.swBomTableColumnType_ItemNumber); if (itemNoColumnIndex == -1)