public OdtTemplate(DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver, IXDocumentParserService xDocumentParserService) : base(documentInformation, xmlNamespaceResolver, xDocumentParserService) { ScriptSectionFormatting(); ReplaceFields(); }
public OdtTemplate( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver, IXDocumentParserService xDocumentParserService ) : base(documentInformation, xmlNamespaceResolver, xDocumentParserService) { ScriptSectionFormatting(); ReplaceFields(); }
public OdsTemplate(DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver, IXDocumentParserService xDocumentParserService) : base(documentInformation, xmlNamespaceResolver, xDocumentParserService) { HandleConditionals(); ReplaceComments(); }
public OdsTemplate( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver, IXDocumentParserService xDocumentParserService ) : base(documentInformation, xmlNamespaceResolver, xDocumentParserService) { HandleConditionals(); ReplaceComments(); }
protected Template( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver, IXDocumentParserService xDocumentParserService ) { OriginalDocument = documentInformation.Document; Meta = documentInformation.Metadata; Manager = xmlNamespaceResolver; _xDocumentParserService = xDocumentParserService; ConvertDocument( documentInformation.Content ); }
protected Template(DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceResolver, IXDocumentParserService xDocumentParserService) { OriginalDocument = documentInformation.Document; Meta = documentInformation.Metadata; Manager = xmlNamespaceResolver; _xDocumentParserService = xDocumentParserService; ConvertDocument(documentInformation.Content); }
public Template GenerateTemplate(DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceService, IXDocumentParserService xDocumentParserService) { switch (documentInformation.FileType) { case OdfHandlerService.FileType.Ods: return(new OdsTemplate(documentInformation, xmlNamespaceService, xDocumentParserService)); case OdfHandlerService.FileType.Odt: return(new OdtTemplate(documentInformation, xmlNamespaceService, xDocumentParserService)); } throw new NotSupportedException( "Only ods and odt files are supported at this time, and this error should have been caught on pattern initialization."); }
public Template GenerateTemplate( DocumentInformation documentInformation, IXmlNamespaceResolver xmlNamespaceService, IXDocumentParserService xDocumentParserService ) { switch( documentInformation.FileType ) { case OdfHandlerService.FileType.Ods: return new OdsTemplate( documentInformation, xmlNamespaceService, xDocumentParserService ); case OdfHandlerService.FileType.Odt: return new OdtTemplate( documentInformation, xmlNamespaceService, xDocumentParserService ); } throw new NotSupportedException( "Only ods and odt files are supported at this time, and this error should have been caught on pattern initialization." ); }
public virtual DocumentInformation BuildDocumentInformation( byte[] document ) { var informationDocument = new byte[document.Length]; document.CopyTo( informationDocument, 0 ); using( var archive = _zipFactory.ZipArchiveFromDocument( document ) ) { var fileType = _zipHandlerService.GetFileType( archive ); var content = _zipHandlerService.GetEntryAsString( archive, "content.xml" ); var metaXml = _zipHandlerService.GetEntryAsString( archive, "meta.xml" ); var metadata = _buildOdfMetadataService.BuildOdfMetadata( metaXml, _manager, _ixDocumentParserService ); var information = new DocumentInformation( fileType, informationDocument, content, metadata ); return information; } }
public virtual DocumentInformation BuildDocumentInformation(byte[] document) { var informationDocument = new byte[document.Length]; document.CopyTo(informationDocument, 0); using (var archive = _zipFactory.ZipArchiveFromDocument(document)) { var fileType = _zipHandlerService.GetFileType(archive); var content = _zipHandlerService.GetEntryAsString(archive, "content.xml"); var metaXml = _zipHandlerService.GetEntryAsString(archive, "meta.xml"); var metadata = _buildOdfMetadataService.BuildOdfMetadata(metaXml, _manager, _ixDocumentParserService); var information = new DocumentInformation(fileType, informationDocument, content, metadata); return(information); } }
public void GeneratesOdtTemplate() { var asm = Assembly.GetExecutingAssembly(); using( var stream = asm.GetManifestResourceStream( "TestProject.OdtContent.xml" ) ) { if( stream == null ) return; var reader = new StreamReader( stream ); _content = reader.ReadToEnd(); } _odtDocumentInformation = new DocumentInformation( OdfHandlerService.FileType.Odt, new byte[0], _content, new OdfMetadata( typeof( object ) ) ); _xDocumentParserService.Setup( x => x.Parse( It.IsAny<string>() ) ).Returns( XDocument.Parse( _content ) ); _sut.GenerateTemplate( _odtDocumentInformation, _xmlNamespaceService, _xDocumentParserService.Object ); _xDocumentParserService.Verify( x => x.Parse( It.IsAny<string>() ) ); }