Ejemplo n.º 1
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;
            }
        }
    }
Ejemplo n.º 2
0
 internal static int smethod_1(RelativeHorizontalPosition A_0)
 {
     return((int)Class791.smethod_3(hashtable_1, A_0, 0));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Insert Image in Word Document
        /// </summary>
        /// <param name="SourceDocumentFilePath">Source/Input Document file's full path</param>
        ///// <param name="TargetDocumentFilePath">Target/Output Document file's full path</param>
        /// <param name="InputImagePath">Image full path(Which needs to be inserted in the document) </param>
        /// <param name="needtoAddHeader">Add header in page page if true  </param>
        /// <param name="ImageWidthDraw">Image-Width in the document</param>
        /// <param name="ImageHeightDraw">Image-Height in the document</param>
        /// <param name="Left">Left</param>
        /// <param name="Top">Top</param>
        /// <returns></returns>
        public static Document InsertHeaderLogo(string SourceDocumentFilePath, string InputImagePath, bool needtoAddHeader = false, double ImageWidthDraw = 120, double ImageHeightDraw = 44, double Left = 10, double Top = 10)
        //, string TargetDocumentFilePath,
        {
            License license1 = new License();

            license1.SetLicense("Aspose.Words.lic");
            Document                   doc = new Document(SourceDocumentFilePath);
            DocumentBuilder            builder;
            RelativeHorizontalPosition h = RelativeHorizontalPosition.Page;
            RelativeVerticalPosition   v = RelativeVerticalPosition.Page;
            WrapType                   w = WrapType.None;
            List <string>              DocListNeedLog = new List <string>
            {
                @"\Subpoenas\State\Michigan\FAX Request.doc"
                , @"\Custodian Letters\All Letter Request Forms\FOIA or Letter Requests\FAX Request.doc"
                , @"\Face Sheets\Face Sheet-DIGITAL ONLY - ONLINE FACE SHEET ONLY.doc"
                , @"\Custodian Letters\All Location Letters & Faxes\Non-Compliance (HIPAA).doc"
            };

            var objDocumentPath = DocListNeedLog.FirstOrDefault(x => SourceDocumentFilePath.ToLower().Replace('/', '\\').Contains(x.ToLower()));

            if (objDocumentPath != null)
            {
                builder = new DocumentBuilder(doc);
                Shape shape;

                switch (objDocumentPath.ToLower().Replace('/', '\\'))
                {
                case @"\subpoenas\state\michigan\fax request.doc":    // 2 LOGO
                case @"\custodian letters\all letter request forms\foia or letter requests\fax request.doc":
                case @"\custodian letters\all location letters & faxes\non-compliance (hipaa).doc":

                    #region Header Logo common across three forms
                    ImageWidthDraw  = 130;
                    ImageHeightDraw = 50;
                    Left            = 45;
                    Top             = 85;
                    builder.InsertImage(InputImagePath, h, Left, v, ConvertUtil.PixelToPoint(Top), ConvertUtil.PixelToPoint(ImageWidthDraw), ConvertUtil.PixelToPoint(ImageHeightDraw), w);
                    #endregion

                    #region LargeLogo

                    builder.MoveToBookmark("LargeLogo");


                    if (objDocumentPath.ToLower() == @"\custodian letters\all location letters & faxes\non-compliance (hipaa).doc")
                    {
                        Left            = 275;
                        ImageWidthDraw  = 305;
                        ImageHeightDraw = 118;
                        Top             = 50;
                    }
                    else     //fax request
                    {
                        Left            = 270;
                        ImageWidthDraw  = 305;
                        ImageHeightDraw = 135;
                        Top             = 90;
                    }

                    shape = builder.InsertImage(InputImagePath);
                    // Make the image float, put it behind text and center on the page
                    shape.WrapType   = WrapType.TopBottom;
                    shape.BehindText = false;
                    shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
                    shape.HorizontalAlignment        = HorizontalAlignment.Center;
                    shape.RelativeVerticalPosition   = RelativeVerticalPosition.Page;
                    //shape.VerticalAlignment = VerticalAlignment.;
                    shape.Top = ConvertUtil.PixelToPoint(Top);
                    //shape.Left = ConvertUtil.PixelToPoint(Left);
                    shape.Width  = ConvertUtil.PixelToPoint(ImageWidthDraw);
                    shape.Height = ConvertUtil.PixelToPoint(ImageHeightDraw);
                    #endregion

                    return(doc);

                    break;

                case @"\face sheets\face sheet-digital only - online face sheet only.doc":    // CENTER LOGO ONLY ONE LOGO
                    ImageWidthDraw  = 305;
                    ImageHeightDraw = 110;
                    Left            = 240;
                    Top             = 170;

                    shape = builder.InsertImage(InputImagePath);
                    // Make the image float, put it behind text and center on the page
                    shape.WrapType   = WrapType.TopBottom;
                    shape.BehindText = false;
                    shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
                    shape.HorizontalAlignment        = HorizontalAlignment.Center;
                    shape.RelativeVerticalPosition   = RelativeVerticalPosition.Page;
                    //shape.VerticalAlignment = VerticalAlignment.;
                    shape.Top = ConvertUtil.PixelToPoint(Top);
                    //shape.Left = ConvertUtil.PixelToPoint(Left);
                    shape.Width  = ConvertUtil.PixelToPoint(ImageWidthDraw);
                    shape.Height = ConvertUtil.PixelToPoint(ImageHeightDraw);
                    return(doc);

                    break;
                }
                return(doc);
            }
            else
            {
                return(doc);
            }


            builder = new DocumentBuilder(doc);
            if (needtoAddHeader)
            {
                Section currentSection = builder.CurrentSection;

                PageSetup pageSetup = currentSection.PageSetup;


                pageSetup.DifferentFirstPageHeaderFooter = false;


                // --- Create header for the first page. ---

                pageSetup.HeaderDistance = 100;

                builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);

                builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;


                // Set font properties for header text.

                builder.Font.Name = "Arial";

                builder.Font.Bold = true;

                builder.Font.Size = 14;


                // Specify header title for the first page.

                builder.Write("...Header Text Here....");


                // --- Create header for pages other than first. ---

                pageSetup.HeaderDistance = 20;

                builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);


                // Insert absolutely positioned image into the top/left corner of the header.

                // Distance from the top/left edges of the page is set to 10 points.

                if (File.Exists(InputImagePath))
                {
                    builder.InsertImage(InputImagePath, RelativeHorizontalPosition.Page, 10, RelativeVerticalPosition.Page, 10, ImageWidthDraw, ImageHeightDraw, WrapType.Through);
                }

                //doc.Save(TargetDocumentFilePath);
            }
            else
            {
                if (File.Exists(InputImagePath))
                {
                    builder.InsertImage(InputImagePath, h, Left, v, Top, ImageWidthDraw, ImageHeightDraw, w);
                }
            }

            return(doc);
        }