예제 #1
0
        public override object Build(FlowElementBuilderContext context, PrintViewDocument element, PrintElementMetadataMap elementMetadataMap)
        {
            var elementContent = new FrameworkFlowDocument
            {
                FontFamily = new FontFamily("Arial")
            };

            FlowElementBuilderHelper.ApplyBaseStyles(elementContent, element);
            FlowElementBuilderHelper.ApplyDocumentStyles(elementContent, element);

            foreach (var block in element.Blocks)
            {
                var blockContent = context.Build <Block>(block, elementMetadataMap);

                elementContent.Blocks.Add(blockContent);
            }

            return(elementContent);
        }
예제 #2
0
        static FlowDocumentBuilder()
        {
            Context = new FlowElementBuilderContext();

            //Blocks
            Context.Register <PrintElementLine, FlowElementLineBuilder>();
            Context.Register <PrintElementList, FlowElementListBuilder>();
            Context.Register <PrintElementPageBreak, FlowElementPageBreakBuilder>();
            Context.Register <PrintElementParagraph, FlowElementParagraphBuilder>();
            Context.Register <PrintElementSection, FlowElementSectionBuilder>();
            Context.Register <PrintElementTable, FlowElementTableBuilder>();

            //Inlines
            Context.Register <PrintElementBold, FlowElementBoldBuilder>();
            Context.Register <PrintElementHyperlink, FlowElementHyperlinkBuilder>();
            Context.Register <PrintElementImage, FlowElementImageBuilder>();
            Context.Register <PrintElementItalic, FlowElementItalicBuilder>();
            Context.Register <PrintElementLineBreak, FlowElementLineBreakBuilder>();
            Context.Register <PrintElementRun, FlowElementRunBuilder>();
            Context.Register <PrintElementSpan, FlowElementSpanBuilder>();
            Context.Register <PrintElementUnderline, FlowElementUnderlineBuilder>();

            Context.Register <PrintViewDocument, FlowElementFlowDocumentBuilder>();
        }
 public object Build(FlowElementBuilderContext context, PrintElement element, PrintElementMetadataMap elementMetadataMap)
 {
     return(Build(context, (TElement)element, elementMetadataMap));
 }
 public abstract object Build(FlowElementBuilderContext context, TElement element, PrintElementMetadataMap elementMetadataMap);