【问题标题】:MigraDoc Formatting Top Align Paragraph with TextFrameMigraDoc Formatting Top Align Paragraph with TextFrame
【发布时间】:2018-06-19 11:49:39
【问题描述】:

对此非常陌生...我似乎无法让左下角的段落与右侧的旋转 TextFrame 对齐。有没有办法在 MigraDoc 中做到这一点? (注意:如果重要的话,红色的文字会流到多个页面上)

另外,我希望 TextFrame 显示在每个生成的页面上,但它没有。

public static Document CreateWorkOrderPDF2(Document document, string filename, string WorkOrderHeader, string myMessage)
    {
        Section section = document.AddSection();
        section.PageSetup.PageFormat = PageFormat.Letter;

        section.PageSetup.StartingNumber = 1;

        section.PageSetup.LeftMargin = 40;
        //Sets the height of the top margin
        section.PageSetup.TopMargin = 100;
        section.PageSetup.RightMargin = 40;
        section.PageSetup.BottomMargin = 40;

        //HeaderFooter
        HeaderFooter header = section.Headers.Primary;
        header.Format.Font.Size = 16;
        header.Format.Font.Color = Colors.DarkBlue;

        MigraDoc.DocumentObjectModel.Shapes.Image headerImage = header.AddImage("../../Fonts/castorgate.regular.png");
        headerImage.Width = "2cm";

        Paragraph headerParagraph = header.AddParagraph(WorkOrderHeader);
        headerParagraph.Format.Font.Name = "Consolas";

         //Vertical Text
        TextFrame myTextFrame = section.AddTextFrame();
        myTextFrame.Orientation = TextOrientation.Downward;
        //moves text to the right
        myTextFrame.Left = 550;
        myTextFrame.Width = 10;
        myTextFrame.Top = 0;
        myTextFrame.Height = 150;

        Paragraph myP = myTextFrame.AddParagraph();
        myP.Format.Alignment = ParagraphAlignment.Left;
        myP.Format.Font.Name = "Consolas";
        myP.Format.Font.Size = 8;
        myP.AddText(WorkOrderHeader);
        myP.Format.Borders.Width = .5;


        //BODY PARAGRAPH
        Paragraph bodyParagraph = section.AddParagraph(myMessage);
        bodyParagraph.Format.Font.Size = 10;
        bodyParagraph.Format.Font.Color = Colors.DarkRed;
        bodyParagraph.Format.Borders.Width = .5;
        bodyParagraph.Format.RightIndent = 50;

        Paragraph renderDate = section.AddParagraph();
        renderDate = section.AddParagraph("Work Order Generated: ");
        renderDate.AddDateField();

        return document;
    }

【问题讨论】:

    标签: format alignment migradoc


    【解决方案1】:

    我想你只需要添加myTextFrame.WrapFormat.Style = WrapStyle.Through;

    【讨论】:

    • 谢谢!我希望我两天前问过!! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 2010-12-16
    • 2012-12-02
    • 2022-12-26
    相关资源
    最近更新 更多