private void button1_Click(object sender, EventArgs e)
        {
            //Create a document
            Document document = new Document();

            //Load file
            document.LoadFromFile(@"..\..\..\..\..\..\Data\TableSample-Az.docx");
            //Get the first section
            Section section = document.Sections[0];
            //Get the first table
            Table table = section.Tables[0] as Table;

            StringBuilder stringBuidler = new StringBuilder();

            //Verify whether the table uses "Around" text wrapping or not.
            if (table.TableFormat.WrapTextAround)
            {
                RowFormat.TablePositioning positon = table.TableFormat.Positioning;

                stringBuidler.AppendLine("Horizontal:");
                stringBuidler.AppendLine("Position:" + positon.HorizPosition + " pt");
                stringBuidler.AppendLine("Absolute Position:" + positon.HorizPositionAbs + ", Relative to:" + positon.HorizRelationTo);
                stringBuidler.AppendLine();
                stringBuidler.AppendLine("Vertical:");
                stringBuidler.AppendLine("Position:" + positon.VertPosition + " pt");
                stringBuidler.AppendLine("Absolute Position:" + positon.VertPositionAbs + ", Relative to:" + positon.VertRelationTo);
                stringBuidler.AppendLine();
                stringBuidler.AppendLine("Distance from surrounding text:");
                stringBuidler.AppendLine("Top:" + positon.DistanceFromTop + " pt, Left:" + positon.DistanceFromLeft + " pt");
                stringBuidler.AppendLine("Bottom:" + positon.DistanceFromBottom + "pt, Right:" + positon.DistanceFromRight + " pt");
            }


            String result = "GetTablePosition_out.txt";

            //Save file.
            File.WriteAllText(result, stringBuidler.ToString());
            //Launching the Word file.
            WordDocViewer(result);
        }
Exemple #2
0
    private static void smethod_1(RowFormat A_0, Class394 A_1)
    {
        int num = 5;

        RowFormat.TablePositioning positioning = A_0.Positioning;
        A_0.method_53(true);
        float num2 = 0f;
        bool  flag = false;

        while (A_1.method_19())
        {
            string key = A_1.method_1();
            if (key != null)
            {
                int num3;
                if (Class1160.dictionary_152 == null)
                {
                    Dictionary <string, int> dictionary1 = new Dictionary <string, int>(10);
                    dictionary1.Add(BookmarkStart.b("䜪䠬䤮䔰甲䜴堶吸漺堼䜾㕀", num), 0);
                    dictionary1.Add(BookmarkStart.b("太䐬䠮夰䜲猴䔶嘸嘺椼娾㥀㝂", num), 1);
                    dictionary1.Add(BookmarkStart.b("弪䈬弮眰䄲娴娶洸帺䔼䬾", num), 2);
                    dictionary1.Add(BookmarkStart.b("䤪䈬嬮䔰尲場然䬸吺值款⑀㭂ㅄ", num), 3);
                    dictionary1.Add(BookmarkStart.b("崪䠬崮䔰爲嬴吶儸吺似", num), 4);
                    dictionary1.Add(BookmarkStart.b("䌪䈬崮䬰爲嬴吶儸吺似", num), 5);
                    dictionary1.Add(BookmarkStart.b("弪伬䌮䄰欲昴䜶尸堺", num), 6);
                    dictionary1.Add(BookmarkStart.b("弪伬䌮䄰欲", num), 7);
                    dictionary1.Add(BookmarkStart.b("弪伬䌮䄰樲昴䜶尸堺", num), 8);
                    dictionary1.Add(BookmarkStart.b("弪伬䌮䄰樲", num), 9);
                    Class1160.dictionary_152 = dictionary1;
                }
                if (Class1160.dictionary_152.TryGetValue(key, out num3))
                {
                    switch (num3)
                    {
                    case 0:
                        num2 = A_1.method_62();
                        if (num2 != float.MaxValue)
                        {
                            positioning.DistanceFromLeft = num2;
                        }
                        break;

                    case 1:
                        num2 = A_1.method_62();
                        if (num2 != float.MaxValue)
                        {
                            positioning.DistanceFromRight = num2;
                        }
                        break;

                    case 2:
                        num2 = A_1.method_62();
                        if (num2 != float.MaxValue)
                        {
                            positioning.DistanceFromTop = num2;
                        }
                        break;

                    case 3:
                        num2 = A_1.method_62();
                        if (num2 != float.MaxValue)
                        {
                            positioning.DistanceFromBottom = num2;
                        }
                        break;

                    case 4:
                        flag = true;
                        positioning.VertRelationTo = Class417.smethod_12(A_1.method_3());
                        break;

                    case 5:
                    {
                        RelativeHorizontalPosition position = Class417.smethod_15(A_1.method_3());
                        positioning.HorizRelationTo = Class417.smethod_22(position);
                        break;
                    }

                    case 6:
                        positioning.HorizPositionAbs = Class417.smethod_17(A_1.method_3());
                        break;

                    case 7:
                        num2 = A_1.method_62();
                        if (num2 != float.MaxValue)
                        {
                            positioning.HorizPositionEx = num2;
                        }
                        break;

                    case 8:
                        goto Label_021E;

                    case 9:
                        goto Label_023B;
                    }
                }
            }
            continue;
Label_021E:
            if (!flag)
            {
                positioning.VertRelationTo = VerticalRelation.Margin;
            }
            positioning.VertPositionAbs = Class417.smethod_20(A_1.method_3());
            continue;
Label_023B:
            if (!flag)
            {
                positioning.VertRelationTo = VerticalRelation.Margin;
            }
            num2 = A_1.method_62();
            if (num2 != float.MaxValue)
            {
                positioning.VertPositionEx = num2;
            }
        }
    }
Exemple #3
0
        internal Table method_78(Interface30 A_0)
        {
            int  num   = 7;
            bool flag  = this.table_0 is Class7;
            bool flag2 = base.method_1() != null;

            if (!flag || flag2)
            {
                this.table_0 = new Class7(this);
                this.table_0.ResetCells(1, 1);
            }
            this.table_0.method_0(base.Owner);
            TableRow  row          = this.table_0.Rows[0];
            TableCell cell         = row.Cells[0];
            float     left         = 0f;
            float     top          = 0f;
            float     bottom       = 0f;
            float     right        = 0f;
            float     width        = 0f;
            float     height       = 0f;
            float     num2         = 0f;
            float     clientHeight = 0f;
            bool      flag4        = true;

            if (base.Owner != null)
            {
                for (IDocumentObject obj2 = base.Owner; !(obj2 is Section); obj2 = obj2.Owner)
                {
                    if (((obj2 is Table) && this.Format.IsAllowInCell) && !(obj2 as Table).IsSDTTable)
                    {
                        this.table_0.IsTextBoxInTable = true;
                        break;
                    }
                    if (obj2.Owner == null)
                    {
                        break;
                    }
                }
                if (A_0.imethod_0().method_28().method_30() != null)
                {
                    Section section = A_0.imethod_0().method_28().method_30() as Section;
                    left   = section.PageSetup.Margins.Left;
                    top    = section.PageSetup.Margins.Top;
                    bottom = section.PageSetup.Margins.Bottom;
                    right  = section.PageSetup.Margins.Right;
                    float footerDistance = section.PageSetup.FooterDistance;
                    float headerDistance = section.PageSetup.HeaderDistance;
                    height       = section.PageSetup.PageSize.Height;
                    width        = section.PageSetup.PageSize.Width;
                    num2         = (A_0.imethod_0().method_135() || (section.Columns.Count <= 0)) ? section.PageSetup.ClientWidth : section.Columns[A_0.imethod_3().Interface30.imethod_4()].Width;
                    clientHeight = section.PageSetup.ClientHeight;
                    if (section.Columns.Count > 1)
                    {
                        flag4 = false;
                    }
                }
            }
            if (this.Format.WidthPercent > 0f)
            {
                float num9 = 0f;
                switch (this.Format.RelationWidth)
                {
                case HorizontalOrigin.Margin:
                    num9 = (num2 * this.Format.WidthPercent) / 100f;
                    break;

                case HorizontalOrigin.Page:
                    num9 = (width * this.Format.WidthPercent) / 100f;
                    break;
                }
                if (((num9 != 0f) && (this.Format.Width != num9)) && (((this.Format.LayoutFlowAlt == TextDirection.TopToBottom) || (this.Format.LayoutFlowAlt == TextDirection.TopToBottomRotated)) || !base.ShapePr.HasKey(0x1023)))
                {
                    this.Format.Width = num9;
                }
            }
            if (this.Format.HeightPercent > 0f)
            {
                float num5 = 0f;
                switch (this.Format.RelationHeight)
                {
                case VerticalOrigin.Margin:
                    num5 = (clientHeight * this.Format.HeightPercent) / 100f;
                    break;

                case VerticalOrigin.Page:
                    num5 = (height * this.Format.HeightPercent) / 100f;
                    break;
                }
                if ((num5 != 0f) && (this.Format.Width != num5))
                {
                    this.Format.Height = num5;
                }
            }
            Color fillColor = new Color();

            if (this.Format.Opacity > 0f)
            {
                fillColor = this.Format.FillColor;
            }
            row.Height = this.Format.Height;
            cell.CellFormat.TextDirection = this.Format.LayoutFlowAlt;
            if (!this.Format.NoLine && (base.ShapeType == ShapeType.TextBox))
            {
                cell.CellFormat.Borders.LineWidth  = this.Format.LineWidth;
                cell.CellFormat.Borders.Color      = this.Format.LineColor;
                cell.CellFormat.Borders.BorderType = this.method_81(this.Format.LineStyle);
            }
            else
            {
                cell.CellFormat.Borders.BorderType = BorderStyle.None;
            }
            if (this.Format.TextWrappingStyle == TextWrappingStyle.Inline)
            {
                goto Label_1240;
            }
            switch (this.Format.VerticalOrigin)
            {
            case VerticalOrigin.Margin:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Margin;
                switch (this.Format.VerticalAlignment)
                {
                case ShapeVerticalAlignment.None:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = clientHeight * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.None;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Top:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = top * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.Top;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Center:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = (clientHeight / 2f) * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = (clientHeight - this.Format.Height) / 2f;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.Center;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Bottom:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = ((clientHeight - this.Format.InternalMargin.Bottom) - bottom) * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = clientHeight - this.Format.Height;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.Bottom;
                    }
                    goto Label_0995;
                }
                break;

            case VerticalOrigin.Page:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Page;
                switch (this.Format.VerticalAlignment)
                {
                case ShapeVerticalAlignment.None:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = height * (this.Format.TopPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Top:
                {
                    RowFormat.TablePositioning positioning = this.table_0.TableFormat.Positioning;
                    positioning.VertPositionEx -= this.Format.InternalMargin.Top;
                    goto Label_0995;
                }

                case ShapeVerticalAlignment.Center:
                    this.table_0.TableFormat.Positioning.VertPositionEx = (height - this.Format.Height) / 2f;
                    goto Label_0995;

                case ShapeVerticalAlignment.Bottom:
                    this.table_0.TableFormat.Positioning.VertPositionEx = (height - this.Format.Height) - this.Format.InternalMargin.Bottom;
                    goto Label_0995;
                }
                break;

            case VerticalOrigin.Paragraph:
            case VerticalOrigin.Line:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Paragraph;
                this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                break;

            case VerticalOrigin.TopMarginArea:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Page;
                if (this.Format.VerticalAlignment == ShapeVerticalAlignment.None)
                {
                    if (Math.Abs(this.Format.TopPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                        break;
                    }
                    this.table_0.TableFormat.Positioning.VertPositionEx = height * (this.Format.TopPercent / 100f);
                }
                break;

            default:
                if (this.table_0.TableFormat.Positioning.VertPositionEx == 0f)
                {
                    this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                }
                break;
            }
Label_0995:
            switch (this.Format.HorizontalOrigin)
            {
            case HorizontalOrigin.Margin:
                this.table_0.TableFormat.Positioning.HorizRelationTo  = HorizontalRelation.Margin;
                this.table_0.TableFormat.Positioning.HorizPositionAbs = HorizontalPosition.Left;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = num2 * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                    }
                    break;

                case ShapeHorizontalAlignment.Left:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (left - this.Format.InternalMargin.Left) * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.table_0.TableFormat.LeftIndent - this.Format.InternalMargin.Left;
                    }
                    break;

                case ShapeHorizontalAlignment.Center:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 / 2f) * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) / 2f;
                    }
                    break;

                case ShapeHorizontalAlignment.Right:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.InternalMargin.Right) * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) - this.Format.InternalMargin.Right;
                    }
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.Page:
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Page;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = width * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                    }
                    break;

                case ShapeHorizontalAlignment.Left:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = 0f;
                    break;

                case ShapeHorizontalAlignment.Center:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (width - this.Format.Width) / 2f;
                    break;

                case ShapeHorizontalAlignment.Right:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = width - this.Format.Width;
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.Column:
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Column;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                    break;

                case ShapeHorizontalAlignment.Left:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = this.table_0.TableFormat.LeftIndent - this.Format.InternalMargin.Left;
                    break;

                case ShapeHorizontalAlignment.Center:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) / 2f;
                    break;

                case ShapeHorizontalAlignment.Right:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) - this.Format.InternalMargin.Right;
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.LeftMarginArea:
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Margin;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Page;
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = width * (this.Format.LeftPercent / 100f);
                    break;

                case ShapeHorizontalAlignment.Left:
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.InternalMargin.Left);
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.InternalMargin.Left) * (this.Format.LeftPercent / 100f);
                    break;

                case ShapeHorizontalAlignment.Center:
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.Width) / 2f;
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = -(left / 2f) * (this.Format.LeftPercent / 100f);
                    break;

                case ShapeHorizontalAlignment.Right:
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = -(this.Format.Width + this.Format.InternalMargin.Right);
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.InternalMargin.Right) * (this.Format.LeftPercent / 100f);
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.RightMarginArea:
                this.table_0.TableFormat.Positioning.HorizRelationTo  = HorizontalRelation.Margin;
                this.table_0.TableFormat.Positioning.HorizPositionAbs = HorizontalPosition.Left;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = num2 + this.Format.HorizontalPosition;
                    break;

                case ShapeHorizontalAlignment.Left:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = num2;
                    break;

                case ShapeHorizontalAlignment.Center:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = num2 + ((right - this.Format.Width) / 2f);
                    break;

                case ShapeHorizontalAlignment.Right:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 + right) - this.Format.Width;
                    break;
                }
                goto Label_11AF;
            }
            if (this.table_0.TableFormat.Positioning.VertPositionEx == 0f)
            {
                this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
            }
Label_11AF:
            this.table_0.TableFormat.method_53(true);
            this.table_0.TableFormat.Positioning.DistanceFromBottom = this.Format.WrapDistanceBottom;
            this.table_0.TableFormat.Positioning.DistanceFromLeft   = this.Format.WrapDistanceLeft;
            this.table_0.TableFormat.Positioning.DistanceFromRight  = this.Format.WrapDistanceRight;
            this.table_0.TableFormat.Positioning.DistanceFromTop    = this.Format.WrapDistanceTop;
Label_1240:
            if ((this.Format.IsInGroupShape || this.Format.IsInShape) && (this.ShapeInfo != null))
            {
                this.table_0.TableFormat.method_53(true);
            }
            if (((this.Format.HorizontalOrigin == HorizontalOrigin.Column) && flag4) && !this.table_0.IsTextBoxInTable)
            {
                RowFormat.TablePositioning positioning2 = this.table_0.TableFormat.Positioning;
                positioning2.HorizPositionEx += left;
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Page;
            }
            if (!this.Format.IsInShape)
            {
                cell.CellFormat.BackColor = fillColor;
            }
            if (base.ShapeType == ShapeType.TextBox)
            {
                if (this.Format.FillEfects.Type == BackgroundType.NoBackground)
                {
                    if (this.Format.TextWrappingStyle == TextWrappingStyle.InFrontOfText)
                    {
                        fillColor = this.Format.FillColor;
                    }
                    else
                    {
                        fillColor = Color.Transparent;
                    }
                }
                else if (this.Format.FillEfects.Type == BackgroundType.Gradient)
                {
                    fillColor = this.Format.FillEfects.Gradient.Color2;
                    cell.CellFormat.TextureStyle = TextureStyle.Texture30Percent;
                }
                if (!this.Format.IsInShape)
                {
                    this.table_0.TableFormat.BackColor = fillColor;
                    cell.CellFormat.BackColor          = fillColor;
                }
            }
            this.table_0.TableFormat.LayoutType      = LayoutType.Fixed;
            this.table_0.TableFormat.Paddings.Left   = this.Format.InternalMargin.Left;
            this.table_0.TableFormat.Paddings.Right  = this.Format.InternalMargin.Right;
            this.table_0.TableFormat.Paddings.Top    = this.Format.InternalMargin.Top;
            this.table_0.TableFormat.Paddings.Bottom = this.Format.InternalMargin.Bottom;
            if (!this.Format.IsFitShapeToText || (this.Format.TextBoxWrapMode != TextBoxWrapMode.None))
            {
                cell.Width = this.Format.Width;
                goto Label_150E;
            }
            cell.CellWidthType = CellWidthType.Auto;
            bool flag3 = true;

            using (IEnumerator enumerator = this.ChildObjects.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DocumentObject current = (DocumentObject)enumerator.Current;
                    if ((current is Paragraph) && (current as Paragraph).Text.Contains(BookmarkStart.b("␬", num)))
                    {
                        goto Label_14AE;
                    }
                }
                goto Label_14C8;
Label_14AE:
                flag3 = false;
            }
Label_14C8:
            if (flag3)
            {
                cell.Width = 0f;
                this.table_0.TableFormat.LayoutType = LayoutType.AutoFit;
                this.table_0.PreferredTableWidth.method_52(FtsWidth.Auto);
            }
Label_150E:
            cell.CellFormat.VerticalAlignment = this.method_80(this.Format.TextAnchor);
            if (this.Format.IsFitShapeToText)
            {
                this.table_0.Rows[0].HeightType = TableRowHeightType.AtLeast;
            }
            else
            {
                this.table_0.Rows[0].HeightType = TableRowHeightType.Exactly;
            }
            if (!flag || flag2)
            {
                int num4  = 0;
                int count = this.Body.Items.Count;
                while (num4 < count)
                {
                    BodyRegion region = this.Body.Items[num4];
                    if ((region.DocumentObjectType == Spire.Doc.Documents.DocumentObjectType.Paragraph) && (region as Paragraph).HasSDTInlineItem)
                    {
                        Paragraph entity = region.Clone() as Paragraph;
                        entity.Items.Clear();
                        int num10 = 0;
                        int num11 = (region as Paragraph).Items.Count;
                        while (num10 < num11)
                        {
                            DocumentObject obj3 = (region as Paragraph).Items[num10];
                            if (obj3 is StructureDocumentTagInline)
                            {
                                foreach (DocumentObject obj4 in (obj3 as StructureDocumentTagInline).SDTContent.Items)
                                {
                                    entity.Items.Add(obj4.Clone());
                                }
                                entity.bool_6 = false;
                            }
                            else
                            {
                                entity.Items.Add(obj3.Clone());
                            }
                            num10++;
                        }
                        cell.Items.Add(entity);
                    }
                    else
                    {
                        cell.Items.Add(region.Clone());
                    }
                    num4++;
                }
            }
            if (this.Format.IsInShape && (this.ShapeInfo != null))
            {
                this.Format.StartPoint = this.ShapeInfo.StartPoint;
            }
            return(this.table_0);
        }
Exemple #4
0
    internal Class1054(RowFormat A_0, bool A_1, Interface52 A_2)
    {
        int num4 = 5;

        this.bool_1 = true;
        this.bool_4 = true;
        this.bool_6 = A_2.imethod_2();
        for (int i = 0; i < A_0.Count; i++)
        {
            int    num2 = A_0.method_18(i);
            object obj2 = A_0.method_19(i);
            int    num3 = num2;
            if (num3 <= 0x10a4)
            {
                if (num3 <= 0x100e)
                {
                    if (num3 <= 0xfa5)
                    {
                        switch (num3)
                        {
                        case 1:
                            if (!(obj2 as Borders).IsDefault)
                            {
                                this.border_4 = (obj2 as Borders).Top;
                                this.border_2 = (obj2 as Borders).Left;
                                this.border_0 = (obj2 as Borders).Bottom;
                                this.border_3 = (obj2 as Borders).Right;
                                this.border_1 = (obj2 as Borders).Horizontal;
                                this.border_5 = (obj2 as Borders).Vertical;
                                this.int_1   += 6;
                            }
                            break;

                        case 3:
                            this.string_18 = A_2.imethod_1().method_23((obj2 as Paddings).Bottom, 20f).ToString();
                            this.string_17 = A_2.imethod_1().method_23((obj2 as Paddings).Left, 20f).ToString();
                            this.string_16 = A_2.imethod_1().method_23((obj2 as Paddings).Top, 20f).ToString();
                            this.string_19 = A_2.imethod_1().method_23((obj2 as Paddings).Right, 20f).ToString();
                            this.int_1    += 4;
                            break;

                        case 0x77:
                            this.bool_0 = (bool)obj2;
                            break;

                        case 120:
                        {
                            this.bool_0 = true;
                            RowFormat.TablePositioning positioning = obj2 as RowFormat.TablePositioning;
                            this.string_3  = (positioning.DistanceFromTop != 0f) ? A_2.imethod_1().method_23(positioning.DistanceFromTop, 20f).ToString() : null;
                            this.string_4  = (positioning.DistanceFromLeft != 9f) ? A_2.imethod_1().method_23(positioning.DistanceFromLeft, 20f).ToString() : null;
                            this.string_5  = (positioning.DistanceFromBottom != 0f) ? A_2.imethod_1().method_23(positioning.DistanceFromBottom, 20f).ToString() : null;
                            this.string_6  = (positioning.DistanceFromRight != 9f) ? A_2.imethod_1().method_23(positioning.DistanceFromRight, 20f).ToString() : null;
                            this.string_8  = Class417.smethod_16(Class417.smethod_21(positioning.HorizRelationTo));
                            this.string_7  = Class417.smethod_14((VerticalOrigin)positioning.VertRelationTo);
                            this.string_9  = (positioning.HorizPositionAbs != HorizontalPosition.Left) ? Class417.smethod_18(positioning.HorizPositionAbs) : null;
                            this.string_11 = (positioning.VertPositionAbs != VerticalPosition.None) ? Class417.smethod_23(positioning.VertPositionAbs) : null;
                            this.string_10 = A_2.imethod_1().method_23(positioning.HorizPositionEx, 20f).ToString();
                            this.string_12 = A_2.imethod_1().method_23(positioning.VertPositionEx, 20f).ToString();
                            this.bool_1    = positioning.TableOverlap;
                            break;
                        }

                        case 0xfa5:
                            if (obj2 != null)
                            {
                                Style style = A_2.imethod_0().Styles.method_13((int)obj2, false);
                                if (A_2.imethod_2())
                                {
                                    this.string_0 = style.StyleId;
                                }
                                else
                                {
                                    this.string_0 = A_2.imethod_4(style.Istd);
                                }
                            }
                            break;
                        }
                    }
                    else
                    {
                        switch (num3)
                        {
                        case 0xfaa:
                        {
                            this.string_13 = Class859.smethod_1((RowAlignment)obj2);
                            this.int_0++;
                            this.int_1++;
                            continue;
                        }

                        case 0xfc8:
                        {
                            if ((bool)obj2)
                            {
                                this.bool_3 = (bool)obj2;
                                this.int_0++;
                            }
                            continue;
                        }
                        }
                        if (num3 == 0x100e)
                        {
                            TableRowHeightType type = (TableRowHeightType)obj2;
                            if (type != TableRowHeightType.AtLeast)
                            {
                                this.string_22 = Class859.smethod_3(type, this.bool_6);
                                this.int_0++;
                            }
                            if ((this.bool_6 && (type == TableRowHeightType.Auto)) && (this.string_21 == null))
                            {
                                this.string_21 = BookmarkStart.b("ᬪ", num4);
                            }
                        }
                    }
                }
                else if (num3 <= 0x1086)
                {
                    switch (num3)
                    {
                    case 0x1018:
                    {
                        this.string_21 = Class1041.smethod_8((int)A_2.imethod_1().method_23(obj2, 20f));
                        this.int_0++;
                        continue;
                    }

                    case 0x102c:
                    {
                        this.string_20 = Class1041.smethod_41(Class531.smethod_1((TableStyleOptions)obj2));
                        this.int_1++;
                        continue;
                    }
                    }
                    if (num3 == 0x1086)
                    {
                        this.class15_0 = (Class15)obj2;
                        if (this.bool_6)
                        {
                            this.int_1++;
                        }
                    }
                }
                else
                {
                    switch (num3)
                    {
                    case 0x1090:
                    {
                        if (!A_1)
                        {
                            this.object_0 = ((LayoutType)obj2) == LayoutType.AutoFit;
                            this.int_1++;
                        }
                        continue;
                    }

                    case 0x109a:
                    {
                        this.int_3 = (int)Math.Round((double)(obj2 as Class15).method_49());
                        if (this.int_3 > 0)
                        {
                            this.int_0++;
                        }
                        continue;
                    }
                    }
                    if (num3 == 0x10a4)
                    {
                        this.int_5 = (int)(obj2 as Class15).method_49();
                        if (this.int_5 > 0)
                        {
                            this.int_0++;
                        }
                    }
                }
            }
            else if (num3 <= 0x1130)
            {
                if (num3 <= 0x10f4)
                {
                    switch (num3)
                    {
                    case 0x10c2:
                    {
                        this.string_14 = A_2.imethod_1().method_23(obj2, 20f).ToString();
                        this.int_0++;
                        this.int_1++;
                        continue;
                    }

                    case 0x10ea:
                    {
                        this.class16_0 = (Class16)obj2;
                        this.int_1++;
                        continue;
                    }
                    }
                    if (num3 == 0x10f4)
                    {
                        this.string_15 = A_2.imethod_1().method_23(obj2, 20f).ToString();
                        this.int_1++;
                    }
                }
                else
                {
                    switch (num3)
                    {
                    case 0x1108:
                    {
                        if (!((bool)obj2))
                        {
                            this.bool_4 = (bool)obj2;
                            this.int_0++;
                        }
                        continue;
                    }

                    case 0x111c:
                    {
                        this.bool_2 = (bool)obj2;
                        continue;
                    }
                    }
                    if (num3 == 0x1130)
                    {
                        this.string_25 = Class114.smethod_5((int)obj2);
                    }
                }
            }
            else if (num3 <= 0x11a8)
            {
                switch (num3)
                {
                case 0x1194:
                {
                    this.string_1 = Class1041.smethod_9((long)obj2);
                    continue;
                }

                case 0x119e:
                {
                    this.string_2 = Class1041.smethod_9((long)obj2);
                    continue;
                }
                }
                if ((num3 == 0x11a8) && A_2.imethod_2())
                {
                    this.bool_5 = true;
                    this.int_0++;
                }
            }
            else
            {
                switch (num3)
                {
                case 0x13f0:
                    this.int_2 = (int)obj2;
                    this.int_0++;
                    break;

                case 0x13f1:
                    this.int_4 = (int)obj2;
                    this.int_0++;
                    break;

                case 0x1392:
                    this.string_24 = (string)obj2;
                    break;

                case 0x1388:
                    this.string_23 = (string)obj2;
                    break;
                }
            }
        }
        if (!A_1)
        {
            if (this.object_0 == null)
            {
                this.object_0 = A_0.LayoutType == LayoutType.AutoFit;
                this.int_1++;
            }
            if ((bool)this.object_0)
            {
                this.int_1--;
            }
        }
        if ((A_0.OwnerBase is Table) && ((A_0.OwnerBase as Table).TableStyle != null))
        {
            if (this.bool_6)
            {
                this.string_0 = (A_0.OwnerBase as Table).TableStyle.StyleId;
            }
            else
            {
                this.string_0 = A_2.imethod_5((A_0.OwnerBase as Table).TableStyle.StyleId);
            }
        }
    }