MigraDoc格式化顶部文本段落与TextFrame

时间:2018-06-19 11:49:40

标签: format alignment migradoc

这很新...我似乎无法使Paragraph的左/左到上与右侧的旋转TextFrame对齐。有没有办法在MigraDoc中做到这一点? (注意:如果有关系,红色文字会流入多页)

此外,我希望TextFrame出现在每个生成的页面上,但不是。

enter image description here enter image description here

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;
    }

1 个答案:

答案 0 :(得分:1)

我认为您只需添加#include <stdio.h> #include <math.h> int main(void) { int item,beg=0,end=6,mid,a[6]={10,21,32,43,54,35}; mid=(beg+end)/2; mid=round(mid); printf("Enter the number you want to search: "); scanf("%d", &item); printf("Item you entered is %d\n",item); while((a[mid]!=item) & (beg<=end)) { if (item<a[mid]) end=mid-1; else beg=mid+1; mid=(beg+end)/2; mid=round(mid); } if (item==a[mid]) printf("Your number is at location %d in array and the number is %d",mid,a[mid]); else printf("Item not found"); return 0; }

相关问题