1         public static int InsertSharedStringItem(string text, pkg.SharedStringTablePart shareStringPart)
 2         {
 3             if (shareStringPart.SharedStringTable == null)
 4             {
 5                 shareStringPart.SharedStringTable = new DOS.SharedStringTable();
 6             }
 7 
 8             int i = 0;
 9 
10             foreach (DOS.SharedStringItem item in shareStringPart.SharedStringTable.Elements<DOS.SharedStringItem>())
11             {
12                 if (item.InnerText == text)
13                 {
14                     return i;
15                 }
16                 i++;
17             }
18 
19             shareStringPart.SharedStringTable.AppendChild(new DOS.SharedStringItem(new DOS.Text(text)));
20             shareStringPart.SharedStringTable.Save();
21 
22             return i;
23         }

 

posted on 2018-09-10 11:37  天之梅子  阅读(312)  评论(0编辑  收藏  举报