示例#1
0
        public TableRow CreateRowObjectiveTitle(int itemNo, Int32Value tableWidth, Int32Value columnNum, UInt32Value rowHeight, StringValue fontSize)
        {
            Int32Value cellWidth = tableWidth / columnNum;

            TableRow tableRow = new GenerateTableRow().Create(
                new GenerateTablePropertyExceptions().Create(
                    new GenerateTableBorders().Create(
                        new GenerateTopBorder().Create(),
                        new GenerateLeftBorder().Create(),
                        new GenerateBottomBorder().Create(),
                        new GenerateRightBorder().Create(),
                        new GenerateInsideHorizontalBorder().Create(),
                        new GenerateInsideVerticalBorder().Create()
                        ),
                    new GenerateTableLayout().Create(),
                    new GenerateTableCellMarginDefault().Create(
                        new GenerateTopMargin().Create(),
                        new GenerateTableCellLeftMargin().Create(),
                        new GenerateBottomMargin().Create(),
                        new GenerateTableCellRightMargin().Create()
                        )
                    ),
                new GenerateTableRowProperties().Create(
                    new GenerateTableCantSplit().Create(),
                    new GenerateTableRowHeight(rowHeight).Create()
                    )
                );

            for (int i = 0; i < columnNum; i++)
            {
                string title      = itemNo++ + "";
                Run    runContent = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().Create(title)
                    );

                Paragraph paragraph = new GenerateParagraph().Create(
                    new GenerateParagraphProperties().Create(
                        new GenerateJustification().Create(JustificationValues.Center)        // 分散对齐
                        )
                    );
                paragraph.Append(runContent);
                tableRow.Append(
                    new GenerateTableCell().Create(
                        new GenerateTableCellProperties().Create(
                            new GenerateTableCellWidth(cellWidth).Create(),
                            new GenerateTableCellBorders().Create(),
                            new GenerateTableCellVerticalAlignment().Create()
                            ),
                        paragraph
                        )
                    );
            }
            return(tableRow);
        }
示例#2
0
        public Paragraph Create(string text)
        {
            string[] striparr = text.Split(new string[] { "\n" }, StringSplitOptions.None);
            striparr = striparr.Where(s => !string.IsNullOrEmpty(s)).ToArray();
            int i = striparr.Length + line;

            TextBoxContent textBoxContent = new TextBoxContent();

            textBoxContent.Append(new GenerateBreakLine().Create());
            foreach (string str in striparr)
            {
                int byteLen = WordLengthUtil.getByteLength(str);
                if (byteLen > 48)
                {
                    i++;
                }
                if (bold)
                {
                    textBoxContent.Append(new GenerateTextItem().CreateBold(str));
                }
                else
                {
                    textBoxContent.Append(new GenerateTextItem().Create(str));
                }
                textBoxContent.Append(new GenerateBreakLine().Create());
            }

            if (i <= 1)
            {
                i++;
            }
            height = i * height;
            string Height = height + "pt";


            Paragraph paragraph = new GenerateParagraph().Create(
                new GenerateRun().Create(
                    new GeneratePicture().Create(
                        new GenerateShape(width, Height).Create(
                            new GeneratePath().Create(),
                            new GenerateFill().Create(),
                            new GenerateStroke(stroke).Create(),
                            new GenerateImageData().Create(),
                            new GenerateLock().Create(),
                            new GenerateTextBox().Create(textBoxContent)
                            )
                        )
                    )
                );

            return(paragraph);
        }
        /// <summary>
        /// 创建空行
        /// </summary>
        /// <returns></returns>
        public Paragraph Create()
        {
            Paragraph paragraph = new GenerateParagraph().Create(
                new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateBold().Create(),
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create()),
                    new GenerateText().Create(" ")
                    )
                );

            return(paragraph);
        }
示例#4
0
        public Paragraph CreateBold(string text)
        {
            Paragraph paragraphBold = new GenerateParagraph().Create(
                new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateBold().Create(),
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create()),
                    new GenerateText().Create(text)
                    )
                );

            return(paragraphBold);
        }
        public Paragraph Create(string text, string fontsize)
        {
            Paragraph paragraph = new GenerateParagraph().Create(
                new GenerateParagraphProperties().Create(
                    new GenerateJustification().Create(JustificationValues.Center)),
                new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateBold().Create(),
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontsize)),
                    new GenerateText().Create(text)
                    )
                );

            return(paragraph);
        }
示例#6
0
        public TableRow CreateRowItem(StringValue title, Int32Value tableWidth, Int32Value columnNum, UInt32Value rowHeight, StringValue fontSize, JustificationValues justification)
        {
            Int32Value cellWidth = tableWidth / columnNum;

            TableRow tableRow = new GenerateTableRow().Create(
                new GenerateTablePropertyExceptions().Create(
                    new GenerateTableBorders().Create(
                        new GenerateTopBorder().Create(),
                        new GenerateLeftBorder().Create(),
                        new GenerateBottomBorder().Create(),
                        new GenerateRightBorder().Create(),
                        new GenerateInsideHorizontalBorder().Create(),
                        new GenerateInsideVerticalBorder().Create()
                        ),
                    new GenerateTableLayout().Create(),
                    new GenerateTableCellMarginDefault().Create(
                        new GenerateTopMargin().Create(),
                        new GenerateTableCellLeftMargin().Create(),
                        new GenerateBottomMargin().Create(),
                        new GenerateTableCellRightMargin().Create()
                        )
                    ),
                new GenerateTableRowProperties().Create(
                    new GenerateTableCantSplit().Create(),
                    new GenerateTableRowHeight(rowHeight).Create()
                    )
                );

            for (int i = 0; i < columnNum; i++)
            {
                Run runLeftSpace = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create("12")
                        ),
                    new GenerateText().Create(" ")
                    );
                Run runRightSpace = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create("12")
                        ),
                    new GenerateText().Create(" ")
                    );
                Run runLeft = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().Create("[ ")
                    );
                Run runRight = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().Create(" ]")
                    );
                Run runContent = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new Color()
                {
                    Val = "C0C0C0"
                },
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().Create(title)
                    );

                Paragraph paragraph = new GenerateParagraph().Create(
                    new GenerateParagraphProperties().Create(
                        new GenerateJustification().Create(justification)        // 分散对齐
                        )
                    );
                if (title.Equals(""))
                {
                    paragraph.Append(runContent);
                }
                else
                {
                    paragraph.Append(runLeft);
                    paragraph.Append(runLeftSpace);
                    paragraph.Append(runContent);
                    paragraph.Append(runRightSpace);
                    paragraph.Append(runRight);
                }
                tableRow.Append(
                    new GenerateTableCell().Create(
                        new GenerateTableCellProperties().Create(
                            new GenerateTableCellWidth(cellWidth).Create(),
                            new GenerateTableCellBorders().Create(),
                            new GenerateTableCellVerticalAlignment().Create()
                            ),
                        paragraph
                        )
                    );
            }
            return(tableRow);
        }
示例#7
0
        internal TableRow CreateRowObjectiveLandscape(int itemNo, string[] itemList, Int32Value tableWidth, Int32Value columnNum, UInt32Value rowHeight, StringValue fontSize)
        {
            Int32Value cellWidth = tableWidth / columnNum;

            TableRow tableRow = new GenerateTableRow().Create(
                new GenerateTablePropertyExceptions().Create(
                    new GenerateTableBorders().Create(
                        new GenerateTopBorder().Create(),
                        new GenerateLeftBorder().Create(),
                        new GenerateBottomBorder().Create(),
                        new GenerateRightBorder().Create(),
                        new GenerateInsideHorizontalBorder().Create(),
                        new GenerateInsideVerticalBorder().Create()
                        ),
                    new GenerateTableLayout().Create(),
                    new GenerateTableCellMarginDefault().Create(
                        new GenerateTopMargin().Create(),
                        new GenerateTableCellLeftMargin().Create(),
                        new GenerateBottomMargin().Create(),
                        new GenerateTableCellRightMargin().Create()
                        )
                    ),
                new GenerateTableRowProperties().Create(
                    new GenerateTableCantSplit().Create(),
                    new GenerateTableRowHeight(rowHeight).Create()
                    )
                );
            Run itemNumber = new GenerateRun().Create(
                new GenerateRunProperties().Create(
                    new GenerateRunFonts().Create(),
                    new Color()
            {
                Val = "C0C0C0"
            },
                    new GenerateFontSize().Create(fontSize)
                    ),
                new GenerateText().Create(itemNo + "")
                );

            Paragraph paragraphNumber = new GenerateParagraph().Create(
                new GenerateParagraphProperties().Create(
                    new GenerateJustification().Create(JustificationValues.Center)        // 分散对齐
                    )
                );

            paragraphNumber.Append(itemNumber);
            tableRow.Append(
                new GenerateTableCell().Create(
                    new GenerateTableCellProperties().Create(
                        new GenerateTableCellWidth(cellWidth).Create(),
                        new GenerateTableCellBorders().Create(),
                        new GenerateTableCellVerticalAlignment().Create()
                        ),
                    paragraphNumber
                    )
                );
            foreach (string item in itemList)
            {
                Run runLeftSpace = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().CreateSpace()
                    );
                Run runRightSpace = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().CreateSpace()
                    );
                Run runLeft = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().Create("[")
                    );
                Run runRight = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().Create("]")
                    );
                Run runContent = new GenerateRun().Create(
                    new GenerateRunProperties().Create(
                        new GenerateRunFonts().Create(),
                        new Color()
                {
                    Val = "C0C0C0"
                },
                        new GenerateFontSize().Create(fontSize)
                        ),
                    new GenerateText().Create(item)
                    );

                Paragraph paragraph = new GenerateParagraph().Create(
                    new GenerateParagraphProperties().Create(
                        new GenerateJustification().Create(JustificationValues.Center)        // 分散对齐
                        )
                    );
                paragraph.Append(runLeft);
                paragraph.Append(runLeftSpace);
                paragraph.Append(runContent);
                paragraph.Append(runRightSpace);
                paragraph.Append(runRight);
                tableRow.Append(
                    new GenerateTableCell().Create(
                        new GenerateTableCellProperties().Create(
                            new GenerateTableCellWidth(cellWidth).Create(),
                            new GenerateTableCellBorders().Create(),
                            new GenerateTableCellVerticalAlignment().Create()
                            ),
                        paragraph
                        )
                    );
            }
            return(tableRow);
        }