// this gets the text iterators for Styles (based on a certain font) runs public void GetTextIteratorListFontStyle(DocXmlDocument doc) { if (!String.IsNullOrEmpty(doc.m_strDefaultStyleFontName)) { UpdateStatusBarDocNamePlusOne("Examining '{0}'... Searching for default paragraph style-based formatting based on font '{1}'...", doc.m_strDefaultStyleFontName); doc.GetTextIteratorForName(doc.m_strDefaultStyleFontName, doc.XPathFormatGetDefaultPStyleFontText, ref mapDefStyleFontNames2Iterator, false); } foreach (string strFontName in doc.lstFontNamesPStyle) { UpdateStatusBarDocNamePlusOne("Examining '{0}'... Searching for paragraph style-based formatting based on font '{1}'...", strFontName); doc.GetTextIteratorForName(strFontName, doc.XPathFormatGetPStyleFontText, ref mapPStyleFontNames2Iterator, false); } foreach (string strFontName in doc.lstFontNamesCStyle) { UpdateStatusBarDocNamePlusOne("Examining '{0}'... Searching for character style-based formatting based on font '{1}'...", strFontName); doc.GetTextIteratorForName(strFontName, doc.XPathFormatGetCStyleFontText, ref mapCStyleFontNames2Iterator, false); } }
protected void GetTextIteratorStyleType(string strStyleType, DocXmlDocument doc, List<string> lstStyleIds, string strXPathFormatText) { foreach (string strStyleId in lstStyleIds) { // get the id of this style (which we've already looked up) // (it may not occur in this particular document... so skip it if not) if (doc.mapStyleId2Name.ContainsKey(strStyleId)) { string strStyleName = doc.mapStyleId2Name[strStyleId]; UpdateStatusBarDocNamePlusTwo("Examining '{0}'... Searching for {1} style-based formatting based on style '{2}'...", strStyleType, strStyleName); if (doc.GetTextIteratorForName(strStyleId, strXPathFormatText, ref mapStyleId2Iterator, false)) { if (!mapName2Font.ContainsKey(strStyleName)) { System.Diagnostics.Debug.Assert(doc.mapStyleName2FontName.ContainsKey(strStyleName)); string strFontName = doc.mapStyleName2FontName[strStyleName]; Font font = CreateFontSafe(strFontName); mapName2Font.Add(strStyleName, font); RowMaxHeight = Math.Max(RowMaxHeight, font.Height); } } } } }
// this gets the text iterators for custom font runs // (i.e. "Fonts only" -- "only custom font runs") public void GetTextIteratorListFontCustom(DocXmlDocument doc) { // now m_astrFullFontNameList is loaded, so let's see which of these has any text associated foreach (string strFontName in doc.lstFontNamesCustom) { UpdateStatusBarDocNamePlusOne("Examining '{0}'... Searching for custom formatting with font '{1}'...", strFontName); doc.GetTextIteratorForName(strFontName, doc.XPathFormatGetFontText, ref mapFontNames2Iterator, false); } // also check for inserted symbols foreach (string strFontName in doc.lstFontNamesSymbolText) { UpdateStatusBarDocNamePlusOne("Examining '{0}'... Searching for inserted symbols with font '{1}'...", strFontName); doc.GetTextIteratorForName(strFontName, doc.XPathFormatGetSymbolFontText, ref mapSymbolFontNames2Iterator, true); } }