示例#1
0
        /// <summary>
        /// Adds new rows to a table.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="count">The count of rows to add.</param>
        /// <param name="index">[optional] The index where to add. If &lt; 0 the row will be added at the bottom of the table. </param>
        /// <param name="countOfColumns">[optional]after a colspan you have to set the columns</param>
        /// <returns><c>true</c> if the row could been added [otherwise] <c>false</c>.</returns>
        public static bool AddRowToTable(ref XTextTable table, int count = 1, int index = -1, uint countOfColumns = 1)
        {
            if (table != null)
            {
                var rows     = table.getRows();
                int rowCount = rows != null?rows.getCount() : 0;

                count = Math.Max(0, count);
                index = index < 0 ? rowCount : index;

                if (rows != null)
                {
                    try
                    {
                        rows.insertByIndex(index, count);
                        if (countOfColumns > 1)
                        {
                            doColSplit(ref table, "A" + ++index, (uint)table.getColumns().getCount() - 1, false);
                        }
                    }
                    catch { return(false); }
                }
                return(true);
            }
            return(false);
        }
示例#2
0
 private static void doColSplit(ref XTextTable table, string startCellName, uint steps, bool horizontal)
 {
     if (table != null && !String.IsNullOrEmpty(startCellName) && steps > 1)
     {
         //get cursor for start cell
         var cursor = table.createCursorByCellName(startCellName);
         if (cursor != null)
         {
             cursor.splitRange((short)steps, horizontal);
         }
     }
 }
示例#3
0
 /// <summary>
 /// Merges table cols in one row to one cell.
 /// </summary>
 /// <param name="table">The table.</param>
 /// <param name="startCellName">Name of the start cell for the colspan. Important: the new cell will have this name.</param>
 /// <param name="steps">The steps to move right for merging e.g. 1 moves merges two cells and results in a colspan of 2.</param>
 public static void DoColSpan(ref XTextTable table, String startCellName, uint steps)
 {
     if (table != null && !String.IsNullOrEmpty(startCellName) && steps > 1)
     {
         //get cursor for start cell
         var cursor = table.createCursorByCellName(startCellName);
         if (cursor != null)
         {
             bool succ = cursor.goRight((short)steps, true);
             cursor.mergeRange();
         }
     }
 }
示例#4
0
        /// <summary>
        /// Don´t useful function, because the size you have to set is a relative value
        /// </summary>
        /// <param name="table">Table you want to resize </param>
        /// <param name="size">relative size you want to set, look for the actual TableColumnSeparators you want to fit.</param>
        /// <param name="index">index of the column you want to resize. From left to right column. if you want to fit the first you have to set the index 0. The rightest column cant resize, you have to set the column before smaller </param>
        public void SetColSize(ref XTextTable table, int size, int index)
        {
            XTableColumns columns  = table.getColumns();
            int           colCount = columns.getCount();

            if (index > colCount)
            {
                System.Console.WriteLine("index was to big");
                return;
            }

            int iWidth = (int)OoUtils.GetIntProperty(table, "Width");

            short sTableColumnRelativeSum = (short)OoUtils.GetProperty(table, "TableColumnRelativeSum");

            double dRatio         = (double)sTableColumnRelativeSum / (double)iWidth;
            double dRelativeWidth = (double)2000 * dRatio;
            double dposition      = sTableColumnRelativeSum - dRelativeWidth;

            TableColumnSeparator[] a = OoUtils.GetProperty(table, "TableColumnSeparators") as TableColumnSeparator[];
            if (a != null)
            {
                System.Console.WriteLine(a[index].Position.ToString() + "was the position before");
                a[index].Position = (short)size;

                //for (int i = a.Length - 1; i >= 0; i--)
                //{
                //    a[i].Position = (short)Math.Ceiling(dposition);
                //    System.Console.WriteLine(dposition);
                //    dposition -= dRelativeWidth;

                //}
                OoUtils.SetProperty(table, "TableColumnSeparators", a);
            }

            //if (column != null)
            //{

            //    //OoUtils.SetIntProperty(column, "Width", size);
            //}
        }
示例#5
0
        /// <summary>
        /// Sets the text value of a cell .
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="cellName">Name of the cell.</param>
        /// <param name="value">The value.</param>
        public static void SetCellTextValue(ref XTextTable table, string cellName, string value, string fontName = "Verdana", int charWeight = 100, short VertOrient = 1, int charHeight = 12, int paraAdjust = 0)
        {
            var a1 = table.getCellByName(cellName);

            if (a1 != null && a1 is XText)
            {
                // set the style of the cell
                // set style for the TextRange before inserting text content!
                var start = ((XTextRange)a1).getStart();
                if (start != null && start is XTextRange)
                {
                    //util.Debug.GetAllProperties(start);
                    OoUtils.SetStringProperty(start, "CharFontName", fontName);
                    OoUtils.SetProperty(start, "CharWeight", (float)charWeight);
                    OoUtils.SetProperty(a1, "VertOrient", VertOrient);
                    OoUtils.SetProperty(start, "CharHeight", charHeight);
                    OoUtils.SetProperty(start, "ParaAdjust", paraAdjust);
                }
                ((XText)a1).setString(value);
            }
        }
示例#6
0
        /// <summary>
        /// Adds new columns to a table.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="count">The count of columns to add.</param>
        /// <param name="index">[optional] The index where to add. If &lt; 0 the column will be added at the right of the table.</param>
        /// <returns><c>true</c> if the column could been added [otherwise] <c>false</c>.</returns>
        public static bool AddColToTable(ref XTextTable table, int count = 1, int index = -1)
        {
            if (table != null)
            {
                var cols     = table.getColumns();
                int colCount = cols != null?cols.getCount() : 0;

                count = Math.Max(0, count);
                index = index < 0 ? colCount : index;

                if (cols != null)
                {
                    try
                    {
                        cols.insertByIndex(index, count);
                    }
                    catch { return(false); }
                }
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Don´t useful function, because the size you have to set is a relative value
        /// </summary>
        /// <param name="table">Table you want to resize </param>
        /// <param name="size">relative size you want to set, look for the actual TableColumnSeparators you want to fit.</param>
        /// <param name="index">index of the column you want to resize. From left to right column. if you want to fit the first you have to set the index 0. The rightest column cant resize, you have to set the column before smaller </param>
        public void SetColSize(ref XTextTable table, int size, int index)
        {
            XTableColumns columns = table.getColumns();
            int colCount = columns.getCount();
            if (index > colCount)
            {
                System.Console.WriteLine("index was to big");
                return;
            }

            int iWidth = (int)OoUtils.GetIntProperty(table, "Width");

            short sTableColumnRelativeSum = (short)OoUtils.GetProperty(table, "TableColumnRelativeSum");

            double dRatio = (double)sTableColumnRelativeSum / (double)iWidth;
            double dRelativeWidth = (double)2000 * dRatio;
            double dposition = sTableColumnRelativeSum - dRelativeWidth;
            TableColumnSeparator[] a = OoUtils.GetProperty(table, "TableColumnSeparators") as TableColumnSeparator[];
            if (a != null)
            {
                System.Console.WriteLine(a[index].Position.ToString() + "was the position before");
                a[index].Position = (short)size;

                //for (int i = a.Length - 1; i >= 0; i--)
                //{
                //    a[i].Position = (short)Math.Ceiling(dposition);
                //    System.Console.WriteLine(dposition);
                //    dposition -= dRelativeWidth;

                //}
                OoUtils.SetProperty(table, "TableColumnSeparators", a);
            }

            //if (column != null)
            //{

            //    //OoUtils.SetIntProperty(column, "Width", size);
            //}

        }
        protected virtual void createPriorityTableContent(ref XTextTable table)
        {

            WriterDocument.SetCellTextValue(ref table, "A2", "Priorität 1 (unbedingt erforderlich)");
            WriterDocument.SetCellTextValue(ref table, "A3", "Priorität 2 (wünschenswert)");
            WriterDocument.SetCellTextValue(ref table, "A4", "Priorität 3 (hilfreich, aber nicht erforderlich)");

            WriterDocument.SetCellTextValue(ref table, "B2", eval.prio1Pass.ToString(), "Verdana", 100, 1, 12, 3);
            WriterDocument.SetCellTextValue(ref table, "B3", eval.prio2Pass.ToString(), "Verdana", 100, 1, 12, 3);
            WriterDocument.SetCellTextValue(ref table, "B4", eval.prio3Pass.ToString(), "Verdana", 100, 1, 12, 3);

            WriterDocument.SetCellTextValue(ref table, "C2", eval.failprio1Count.ToString(), "Verdana", 100, 1, 12, 3);
            WriterDocument.SetCellTextValue(ref table, "C3", eval.failprio2Count.ToString(), "Verdana", 100, 1, 12, 3);
            WriterDocument.SetCellTextValue(ref table, "C4", eval.failprio3Count.ToString(), "Verdana", 100, 1, 12, 3);

            WriterDocument.SetCellTextValue(ref table, "D2", eval.prio1Count.ToString(), "Verdana", 100, 1, 12, 3);
            WriterDocument.SetCellTextValue(ref table, "D3", eval.prio2Count.ToString(), "Verdana", 100, 1, 12, 3);
            WriterDocument.SetCellTextValue(ref table, "D4", eval.prio3Count.ToString(), "Verdana", 100, 1, 12, 3);
        }
 /// <summary>
 /// Sets the text value of a cell .
 /// </summary>
 /// <param name="table">The table.</param>
 /// <param name="cellName">Name of the cell.</param>
 /// <param name="value">The value.</param>
 public static void SetCellTextValue(ref XTextTable table, string cellName, string value, string fontName = "Verdana", int charWeight = 100, short VertOrient = 1, int charHeight = 12, int paraAdjust = 0)
 {
     var a1 = table.getCellByName(cellName);
     if (a1 != null && a1 is XText)
     {
         // set the style of the cell
         // set style for the TextRange before inserting text content!
         var start = ((XTextRange)a1).getStart();
         if (start != null && start is XTextRange)
         {
             //util.Debug.GetAllProperties(start);
             OoUtils.SetStringProperty(start, "CharFontName", fontName);
             OoUtils.SetProperty(start, "CharWeight", (float)charWeight);
             OoUtils.SetProperty(a1, "VertOrient", VertOrient);
             OoUtils.SetProperty(start, "CharHeight", charHeight);
             OoUtils.SetProperty(start, "ParaAdjust", paraAdjust);
         }
         ((XText)a1).setString(value);
     }
 }
 protected virtual void FillPriorityTable(ref XTextTable table)
 {
     createPriorityTableHeader(ref table);
     createPriorityTableContent(ref table);
 }
 private void setStyleOfTable(ref XTextTable table)
 {
     if (table != null)
     {
         // util.Debug.GetAllProperties(table);
     }
 }
        private void SetCellCriterionTextValue(ref XTextTable table, string cellName, string name)
        {
            var a1 = table.getCellByName(cellName);
            if (a1 != null && a1 is XText)
            {
                // set the style of the cell
                // set style for the TextRange before inserting text content!
                var start = ((XTextRange)a1).getStart();
                if (start != null && start is XTextRange)
                {

                    OoUtils.SetStringProperty(start, "CharFontName", "Verdana");
                    OoUtils.SetProperty(start, "CharWeight", (float)150.000000);
                    // OoUtils.SetIntProperty(start,"",3 );
                }

                //OoUtils.SetIntProperty(WriterDoc.TextViewCursor, "CharWeight", 2000);
                ((XText)a1).setString(name);

                //util.Debug.GetAllInterfacesOfObject(a1);

                //util.Debug.GetAllProperties(a1 as XText);

            }
        }
        protected override void SetCellTextList(ref XTextTable table, string cellName, Criterion cr)
        {
            String items;
            var a1 = table.getCellByName(cellName);
            if (a1 != null && a1 is XText)
            {
                // set the style of the cell
                // set style for the TextRange before inserting text content!
                var start = ((XTextRange)a1).getStart();
                if (start != null && start is XTextRange)
                {
                    OoUtils.SetStringProperty(start, "NumberingStyleName", WriterDocument.ParaStyleName.LIST_1);
                    OoUtils.SetStringProperty(start, "CharFontName", "Verdana");
                    OoUtils.SetProperty(start, "CharWeight", (float)100.000000);

                    items = CreateStringFailedItems(cr);
                    ((XText)a1).setString(items);
                }
            }
        }
        protected void setHeaderCellTextValue(ref XTextTable table, string cellName, string value)
        {
            var a1 = table.getCellByName(cellName);
            if (a1 != null && a1 is XText)
            {
                // set the style of the cell
                // set style for the TextRange before inserting text content!
                var start = ((XTextRange)a1).getStart();
                if (start != null && start is XTextRange)
                {

                    OoUtils.SetStringProperty(start, "CharFontName", "Verdana");
                    OoUtils.SetProperty(start, "CharWeight", (float)150.000000);
                }
                ((XText)a1).setString(value);
            }
        }
 protected virtual void SetCellTextList(ref XTextTable table, string cellName, Criterion cr)
 {
     throw new NotImplementedException();
 }
 protected virtual void FillColWithText(ref XTextTable table, int colCount, Criterion cr, int crNumber, int caNumber)
 {
     WriterDocument.SetCellTextValue(ref table, "A" + colCount, caNumber + "." + crNumber + " " + cr.Name);
     SetCellTextList(ref table, "B" + colCount, cr);
     //SetCellTextValue(ref table, "B" + colCount, caNumber + "." + crNumber + " " + cr.Name);
     WriterDocument.SetCellTextValue(ref table, "C" + colCount, cr.Comment);
     WriterDocument.SetCellTextValue(ref table, "D" + colCount, cr.Priority.ToString(), "Verdana", 150, 1, 13);
 }
        protected virtual void createPriorityTableHeader(ref XTextTable table)
        {
            WriterDocument.SetCellTextValue(ref table, "A1", "Kriterien","Verdana", 150);
            WriterDocument.SetCellTextValue(ref table, "B1", "Bestanden", "Verdana", 150);
            //var cell = table.getCellByName("A1");

            WriterDocument.SetCellTextValue(ref table, "C1", "Nicht bestanden", "Verdana", 150);
            WriterDocument.SetCellTextValue(ref table, "D1", "Gesamtanzahl", "Verdana", 150);
            //WriterDocument.SetCellTextValue(ref table, "E1", "verbesserungswürdig");

        }
        /// <summary>
        /// Adds new rows to a table.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="count">The count of rows to add.</param>
        /// <param name="index">[optional] The index where to add. If &lt; 0 the row will be added at the bottom of the table. </param>
        /// <param name="countOfColumns">[optional]after a colspan you have to set the columns</param>
        /// <returns><c>true</c> if the row could been added [otherwise] <c>false</c>.</returns>
        public static bool AddRowToTable(ref XTextTable table, int count = 1, int index = -1, uint countOfColumns = 1)
        {

            if (table != null)
            {

                var rows = table.getRows();
                int rowCount = rows != null ? rows.getCount() : 0;

                count = Math.Max(0, count);
                index = index < 0 ? rowCount : index;

                if (rows != null)
                {
                    try
                    {
                        rows.insertByIndex(index, count);
                        if (countOfColumns > 1)
                        {
                            doColSplit(ref table, "A" + ++index, (uint)table.getColumns().getCount() - 1, false);
                        }
                    }
                    catch { return false; }
                }
                return true;
            }
            return false;
        }
        private static void doColSplit(ref XTextTable table, string startCellName, uint steps, bool horizontal)
        {
            if (table != null && !String.IsNullOrEmpty(startCellName) && steps > 1)
            {
                //get cursor for start cell
                var cursor = table.createCursorByCellName(startCellName);
                if (cursor != null)
                {

                    cursor.splitRange((short)steps, horizontal);
                }
            }
        }
        /// <summary>
        /// fill the table for the improvable categories 
        /// </summary>
        /// <param name="caNumber">index number of the categorie eg. 1. Bildaufbau</param>
        /// <param name="rowCount">Number of the row which has to fill</param>
        /// <param name="table2">table to fill</param>
        /// <param name="ca">category to check</param>
        private void addImprovableCategoriesToTable(int caNumber, ref  int rowCount, ref XTextTable table2, Category ca)
        {            
            bool lastRowColSpan2 = false;
            int crNumber = 1;
            bool CategoryHeaderWasMade = false;

            //WriterDoc.AppendNewStyledTextParagraphAndGetTextRange(caNumber +". "+ ca.Name, WriterDocument.ParaStyleName.HEADING);
            foreach (Criterion cr in ca.Criteria)
            {


                if (cr.Res.resultType == ResultType.passwithwarning)
                {
                    if (CategoryHeaderWasMade == false)
                    {
                        WriterDocument.AddRowToTable(ref table2);
                        rowCount++;
                        WriterDocument.DoColSpan(ref table2, "A" + rowCount, 3);
                        lastRowColSpan2 = true;
                        SetCellCriterionTextValue(ref table2, "A" + rowCount, caNumber + "." + ca.Name);
                        CategoryHeaderWasMade = true;
                    }

                    if (lastRowColSpan2 == true)
                    {
                        WriterDocument.AddRowToTable(ref table2, 1, -1, 4);
                        FillColWithText(ref table2, ++rowCount, cr, crNumber, caNumber);
                        lastRowColSpan2 = false;
                    }
                    else
                    {
                        WriterDocument.AddRowToTable(ref table2);
                        FillColWithText(ref table2, ++rowCount, cr, crNumber, caNumber);
                    }


                }
                crNumber++;
            }
        }
        /// <summary>
        /// Adds new columns to a table.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="count">The count of columns to add.</param>
        /// <param name="index">[optional] The index where to add. If &lt; 0 the column will be added at the right of the table.</param>
        /// <returns><c>true</c> if the column could been added [otherwise] <c>false</c>.</returns>
        public static bool AddColToTable(ref XTextTable table, int count = 1, int index = -1)
        {
            if (table != null)
            {
                var cols = table.getColumns();
                int colCount = cols != null ? cols.getCount() : 0;

                count = Math.Max(0, count);
                index = index < 0 ? colCount : index;

                if (cols != null)
                {
                    try
                    {
                        cols.insertByIndex(index, count);
                    }
                    catch { return false; }
                }
                return true;
            }
            return false;
        }
        protected override void SetCellTextList(ref XTextTable table, string cellName, Criterion cr)
        {
            //base.SetCellTextList(ref table, cellName, cr);

            String itemsFail;
            String itemsPass;
            var a1 = table.getCellByName(cellName);
            if (a1 != null && a1 is XText)
            {
                // set the style of the cell
                // set style for the TextRange before inserting text content!
                var start = ((XTextRange)a1).getStart();
                if (start != null && start is XTextRange)
                {
                    itemsFail = createStringFailedItems(cr);
                    itemsPass = CreateStringPassedItems(cr);
                    XTextCursor xTextCurser = ((XText)a1).createTextCursor();
                    xTextCurser.gotoEnd(false);
                    if (itemsFail != String.Empty)
                    {
                        OoUtils.SetStringProperty(xTextCurser, "NumberingStyleName", WriterDocument.ParaStyleName.NONE);
                        OoUtils.SetProperty(xTextCurser, "CharWeight", 150);
                        OoUtils.SetProperty(xTextCurser, "CharHeight", 12);
                        ((XText)a1).insertString(xTextCurser, "Nicht erfüllt: \r", false);

                        xTextCurser.gotoEnd(false);
                        OoUtils.SetStringProperty(xTextCurser, "NumberingStyleName", WriterDocument.ParaStyleName.LIST_1);
                        OoUtils.SetStringProperty(xTextCurser, "CharFontName", "Verdana");
                        OoUtils.SetProperty(xTextCurser, "CharWeight", (float)100.000000);
                        OoUtils.SetProperty(xTextCurser, "CharHeight", 12);
                        ((XText)a1).insertString(xTextCurser, itemsFail, false);
                        xTextCurser.gotoEnd(false);
                        //OoUtils.SetStringProperty(xTextCurser, "NumberingStyleName", WriterDocument.ParaStyleName.NONE);


                    }
                    if (itemsPass != String.Empty && itemsFail != String.Empty)
                    {
                        ((XText)a1).insertString(xTextCurser, "\r", false);
                        //XTextCursor xTextCurser2 = ((XText)a1).createTextCursor();
                        xTextCurser.gotoEnd(false);

                        OoUtils.SetStringProperty(xTextCurser, "NumberingStyleName", WriterDocument.ParaStyleName.NONE);
                        OoUtils.SetProperty(xTextCurser, "CharWeight", 150);
                        OoUtils.SetProperty(xTextCurser, "CharHeight", 12);
                        ((XText)a1).insertString(xTextCurser, "\rErfüllt: \r", false);
                        xTextCurser.gotoEnd(false);
                        OoUtils.SetStringProperty(xTextCurser, "NumberingStyleName", WriterDocument.ParaStyleName.LIST_1);
                        OoUtils.SetStringProperty(xTextCurser, "CharFontName", "Verdana");
                        OoUtils.SetProperty(xTextCurser, "CharWeight", (float)100.000000);
                        OoUtils.SetProperty(xTextCurser, "CharHeight", 12);
                        ((XText)a1).insertString(xTextCurser, itemsPass, false);
                        xTextCurser.gotoEnd(false);
                        return;

                    }
                    if (itemsPass != String.Empty)
                    {
                        OoUtils.SetStringProperty(xTextCurser, "NumberingStyleName", WriterDocument.ParaStyleName.NONE);
                        OoUtils.SetProperty(xTextCurser, "CharWeight", 150);
                        OoUtils.SetProperty(xTextCurser, "CharHeight", 12);
                        ((XText)a1).insertString(xTextCurser, "Erfüllt: \r", false);
                        xTextCurser.gotoEnd(false);
                        OoUtils.SetStringProperty(xTextCurser, "NumberingStyleName", WriterDocument.ParaStyleName.LIST_1);
                        OoUtils.SetStringProperty(xTextCurser, "CharFontName", "Verdana");
                        OoUtils.SetProperty(xTextCurser, "CharWeight", (float)100.000000);
                        OoUtils.SetProperty(xTextCurser, "CharHeight", 12);
                        ((XText)a1).insertString(xTextCurser, itemsPass, false);
                        xTextCurser.gotoEnd(false);
                    }

                }
            }
        }
 /// <summary>
 /// Merges table cols in one row to one cell.
 /// </summary>
 /// <param name="table">The table.</param>
 /// <param name="startCellName">Name of the start cell for the colspan. Important: the new cell will have this name.</param>
 /// <param name="steps">The steps to move right for merging e.g. 1 moves merges two cells and results in a colspan of 2.</param>
 public static void DoColSpan(ref XTextTable table, String startCellName, uint steps)
 {
     if (table != null && !String.IsNullOrEmpty(startCellName) && steps > 1)
     {
         //get cursor for start cell
         var cursor = table.createCursorByCellName(startCellName);
         if (cursor != null)
         {
             bool succ = cursor.goRight((short)steps, true);
             cursor.mergeRange();
         }
     }
 }
        private void createTableHeaders(ref XTextTable table)
        {
            setHeaderCellTextValue(ref table, "A1", "Kategorie");
            setHeaderCellTextValue(ref table, "B1", "Prüfpunkte");
            //var cell = table.getCellByName("A1");

            setHeaderCellTextValue(ref table, "C1", "Bemerkung des Prüfers");
            setHeaderCellTextValue(ref table, "D1", "Priorität");

        }
示例#25
0
        static void Main(string[] args)
        {
            InitOpenOfficeEnvironment();
            XMultiServiceFactory multiServiceFactory = Connect();
            XComponent           xComponent          = null;

            string docFileName = @"C:\test3.doc";

            try
            {
                XComponentLoader componentLoader =
                    (XComponentLoader)multiServiceFactory
                    .createInstance("com.sun.star.frame.Desktop");
                //set the property
                PropertyValue[] propertyValue = new PropertyValue[1];
                PropertyValue   aProperty     = new PropertyValue();
                aProperty.Name   = "Hidden";
                aProperty.Value  = new uno.Any(false);
                propertyValue[0] = aProperty;
                xComponent       =
                    componentLoader
                    .loadComponentFromURL(PathConverter(docFileName),
                                          "_blank", 0, propertyValue);
                XTextDocument      xTextDocument      = ((XTextDocument)xComponent);
                XEnumerationAccess xEnumerationAccess =
                    (XEnumerationAccess)xTextDocument.getText();
                XEnumeration xParagraphEnumeration =
                    xEnumerationAccess.createEnumeration();
                while (xParagraphEnumeration.hasMoreElements())
                {
                    uno.Any      element = xParagraphEnumeration.nextElement();
                    XServiceInfo xinfo   = (XServiceInfo)element.Value;
                    if (xinfo.supportsService("com.sun.star.text.TextTable"))
                    {
                        Console.WriteLine("Found Table!");

                        XTextTable xTextTable = (XTextTable)element.Value;
                        String[]   cellNames  = xTextTable.getCellNames();

                        for (int i = 0; i < cellNames.Length; i++)
                        {
                            XCell  xCell     = xTextTable.getCellByName(cellNames[i]);
                            XText  xTextCell = (XText)xCell;
                            String strText   = xTextCell.getString();
                            Console.WriteLine(strText);
                        }
                    }
                    else
                    {
                        XTextContent       xTextElement           = (XTextContent)element.Value;
                        XEnumerationAccess xParaEnumerationAccess =
                            (XEnumerationAccess)xTextElement;
                        // create another enumeration to get all text portions of
                        //the paragraph
                        XEnumeration xTextPortionEnum =
                            xParaEnumerationAccess.createEnumeration();
                        //step 3  Through the Text portions Enumeration, get interface
                        //to each individual text portion
                        while (xTextPortionEnum.hasMoreElements())
                        {
                            XTextRange xTextPortion =
                                (XTextRange)xTextPortionEnum.nextElement().Value;
                            Console.Write(xTextPortion.getString());
                        }
                    }
                }
            }
            catch (unoidl.com.sun.star.uno.Exception exp1)
            {
                Console.WriteLine(exp1.Message);
                Console.WriteLine(exp1.StackTrace);
            }
            catch (System.Exception exp2)
            {
                Console.WriteLine(exp2.Message);
                Console.WriteLine(exp2.StackTrace);
            }
            finally
            {
                xComponent.dispose();
                xComponent = null;
            }
            Console.WriteLine("Done.");
            Console.ReadLine();
        }