private void TestWriteStartDocument(ConstrWriter writerConstr, WriteStartDoc write, bool?standalone) { using var stream = new MemoryStream(); using var newDoc = WordprocessingDocument.Create(stream, WordprocessingDocumentType.Document); var part = newDoc.AddMainDocumentPart(); using (var writer = writerConstr(part)) { write(writer, standalone); } VerifyDocumentStart(part, standalone); }
private void TestWriteStartElement(ConstrWriter writerConstr, WriteStartEle write, object writeSource, IEnumerable <OpenXmlAttribute> attributes, IEnumerable <KeyValuePair <string, string> > namespaceDeclarations) { using var ms = new MemoryStream(); using var newDoc = WordprocessingDocument.Create(ms, WordprocessingDocumentType.Document); var part = newDoc.AddMainDocumentPart(); using (var stream = part.GetStream()) using (var writer = OpenXmlWriter.Create(stream)) { write(writer, writeSource, attributes, namespaceDeclarations); } VerifyStartElement(part, writeSource, attributes, namespaceDeclarations); }