Beispiel #1
0
 internal ListEntry(PAPX papx, Range parent, ListTables tables)
     : base(papx, parent)
 {
     if (tables != null)
     {
         ListFormatOverride override1 = tables.GetOverride(_props.GetIlfo());
         _overrideLevel = override1.GetOverrideLevel(_props.GetIlvl());
         _level         = tables.GetLevel(override1.GetLsid(), _props.GetIlvl());
     }
     else
     {
         //log.log(POILogger.WARN, "No ListTables found for ListEntry - document probably partly corrupt, and you may experience problems");
     }
 }
Beispiel #2
0
        protected void ProcessParagraphes(HWPFDocumentCore wordDocument,
                                          XmlElement flow, Range range, int currentTableLevel)
        {
            ListTables listTables      = wordDocument.GetListTables();
            int        currentListInfo = 0;

            int paragraphs = range.NumParagraphs;

            for (int p = 0; p < paragraphs; p++)
            {
                Paragraph paragraph = range.GetParagraph(p);

                if (paragraph.IsInTable() && paragraph.GetTableLevel() != currentTableLevel)
                {
                    if (paragraph.GetTableLevel() < currentTableLevel)
                    {
                        throw new InvalidOperationException(
                                  "Trying to process table cell with higher level ("
                                  + paragraph.GetTableLevel()
                                  + ") than current table level ("
                                  + currentTableLevel
                                  + ") as inner table part");
                    }

                    Table table = range.GetTable(paragraph);
                    ProcessTable(wordDocument, flow, table);

                    p += table.NumParagraphs;
                    p--;
                    continue;
                }

                if (paragraph.Text.Equals("\u000c"))
                {
                    ProcessPageBreak(wordDocument, flow);
                }

                if (paragraph.GetIlfo() != currentListInfo)
                {
                    currentListInfo = paragraph.GetIlfo();
                }

                if (currentListInfo != 0)
                {
                    if (listTables != null)
                    {
                        ListFormatOverride listFormatOverride = listTables.GetOverride(paragraph.GetIlfo());

                        String label = AbstractWordUtils.GetBulletText(listTables,
                                                                       paragraph, listFormatOverride.GetLsid());

                        ProcessParagraph(wordDocument, flow, currentTableLevel,
                                         paragraph, label);
                    }
                    else
                    {
                        logger.Log(POILogger.WARN,
                                   "Paragraph #" + paragraph.StartOffset + "-"
                                   + paragraph.EndOffset
                                   + " has reference to list structure #"
                                   + currentListInfo
                                   + ", but listTables not defined in file");

                        ProcessParagraph(wordDocument, flow, currentTableLevel,
                                         paragraph, string.Empty);
                    }
                }
                else
                {
                    ProcessParagraph(wordDocument, flow, currentTableLevel,
                                     paragraph, string.Empty);
                }
            }
        }