private List <WordItem> CreateWordItems(List <SwParagraph> paragraphs, List <SwStyle> description) { List <WordItem> wordItems = new List <WordItem>(); WordItem currentWordItem = null; for (int i = 0; i < paragraphs.Count; i++) { SwParagraph tmpParagraph = paragraphs[i]; if ((from d in description where d.Name.Equals(tmpParagraph.Style.Name) select d).Count() > 0) { if (currentWordItem == null) { currentWordItem = new WordItem(); wordItems.Add(currentWordItem); } currentWordItem.DescriptionParagraphs.Add(tmpParagraph); } else { currentWordItem = new WordItem(); currentWordItem.MainParagraph = tmpParagraph; wordItems.Add(currentWordItem); } } return(wordItems); }
private IswItem CreateWordItem(IswItem currentItem, SwParagraph paragraph, string createSID, /* ref string oldVersionID, */ string descriptionRtf) { IswItem newItem; newItem = currentItem.HomeLibrary.CreateItem(createSID, paragraph.Text); try { newItem.Description = SWDescription.MakeDescription(SWUtility.RtfToRvfz(descriptionRtf)); } catch (Exception ex) { LogToDescription(String.Format("Couldn't write description to {0} ({1}) as {2}", newItem.Name, newItem.HandleStr, newItem.swItemType.SID)); MessageBox.Show(ex.Message); } return(newItem); }