|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.IO; |
| 4 | +using System.Linq; |
| 5 | +using System.Xml.Linq; |
| 6 | +using DocSharp.Docx; |
| 7 | +using DocumentFormat.OpenXml; |
| 8 | +using DocumentFormat.OpenXml.Packaging; |
| 9 | +using DocumentFormat.OpenXml.Wordprocessing; |
| 10 | +using QuestPDF.Fluent; |
| 11 | +using QuestPDF.Infrastructure; |
| 12 | +using Document = QuestPDF.Fluent.Document; |
| 13 | + |
| 14 | +namespace DocSharp.Renderer; |
| 15 | + |
| 16 | +internal class DocxRenderer : DocxEnumerator<QuestPDF.Fluent.Document>, IDocumentRenderer<QuestPDF.Fluent.Document> |
| 17 | +{ |
| 18 | + /// <summary> |
| 19 | + /// Render a DOCX document to a QuestPDF document. |
| 20 | + /// </summary> |
| 21 | + /// <param name="inputDocument">The input WordprocessingDocument instance.</param> |
| 22 | + /// <returns></returns> |
| 23 | + public QuestPDF.Fluent.Document Render(WordprocessingDocument inputDocument) |
| 24 | + { |
| 25 | + var outputDoc = QuestPDF.Fluent.Document.Create((_) => |
| 26 | + { |
| 27 | + |
| 28 | + }); |
| 29 | + throw new NotImplementedException(); |
| 30 | + } |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// Render a DOCX document to a QuestPDF document. |
| 34 | + /// </summary> |
| 35 | + /// <param name="inputStream">The input DOCX stream.</param> |
| 36 | + public QuestPDF.Fluent.Document Render(Stream inputStream) |
| 37 | + { |
| 38 | + using var docx = WordprocessingDocument.Open(inputStream, false); |
| 39 | + return Render(docx); |
| 40 | + } |
| 41 | + |
| 42 | + /// <summary> |
| 43 | + /// Render a Flat OPC (Open XML) document to a QuestPDF document. |
| 44 | + /// </summary> |
| 45 | + /// <param name="flatOpc">The Flat OPC XDocument.</param> |
| 46 | + public QuestPDF.Fluent.Document Render(XDocument flatOpc) |
| 47 | + { |
| 48 | + using (var docx = WordprocessingDocument.FromFlatOpcDocument(flatOpc)) |
| 49 | + return Render(docx); |
| 50 | + } |
| 51 | + |
| 52 | + internal override void ProcessAnnotationReference(AnnotationReferenceMark annotationRef, Document sb) |
| 53 | + { |
| 54 | + } |
| 55 | + |
| 56 | + internal override void ProcessBookmarkEnd(BookmarkEnd bookmarkEnd, Document sb) |
| 57 | + { |
| 58 | + } |
| 59 | + |
| 60 | + internal override void ProcessBookmarkStart(BookmarkStart bookmarkStart, Document sb) |
| 61 | + { |
| 62 | + } |
| 63 | + |
| 64 | + internal override void ProcessBreak(Break @break, Document sb) |
| 65 | + { |
| 66 | + } |
| 67 | + |
| 68 | + internal override void ProcessCommentEnd(CommentRangeEnd commentEnd, Document sb) |
| 69 | + { |
| 70 | + } |
| 71 | + |
| 72 | + internal override void ProcessCommentReference(CommentReference commentRef, Document sb) |
| 73 | + { |
| 74 | + } |
| 75 | + |
| 76 | + internal override void ProcessCommentStart(CommentRangeStart commentStart, Document sb) |
| 77 | + { |
| 78 | + } |
| 79 | + |
| 80 | + internal override void ProcessDocumentBackground(DocumentBackground background, Document sb) |
| 81 | + { |
| 82 | + } |
| 83 | + |
| 84 | + internal override void ProcessDrawing(Drawing picture, Document sb) |
| 85 | + { |
| 86 | + } |
| 87 | + |
| 88 | + internal override void ProcessFieldChar(FieldChar field, Document sb) |
| 89 | + { |
| 90 | + } |
| 91 | + |
| 92 | + internal override void ProcessFieldCode(FieldCode field, Document sb) |
| 93 | + { |
| 94 | + } |
| 95 | + |
| 96 | + internal override void ProcessMathElement(OpenXmlElement element, Document sb) |
| 97 | + { |
| 98 | + } |
| 99 | + |
| 100 | + internal override void ProcessPageNumber(PageNumber pageNumber, Document sb) |
| 101 | + { |
| 102 | + } |
| 103 | + |
| 104 | + internal override void ProcessPositionalTab(PositionalTab posTab, Document sb) |
| 105 | + { |
| 106 | + } |
| 107 | + |
| 108 | + internal override void ProcessSymbolChar(SymbolChar symbolChar, Document sb) |
| 109 | + { |
| 110 | + } |
| 111 | + |
| 112 | + internal override void ProcessText(Text text, Document sb) |
| 113 | + { |
| 114 | + } |
| 115 | + |
| 116 | + internal override void ProcessVml(OpenXmlElement picture, Document sb) |
| 117 | + { |
| 118 | + } |
| 119 | + |
| 120 | + internal override void EnsureSpace(Document sb) |
| 121 | + { |
| 122 | + } |
| 123 | +} |
0 commit comments