コード例 #1
0
        private void ProcessPackage(DataReader reader, DocxPackagePart package, DocxGeneratorSettings actualSettings)
        {
            var parser        = this.ParserFactory.Create();
            var rootProcessor = this.ProcessorFactory.Create();

            parser.Parse(rootProcessor, package.PartXml.Root);

            reader.MissingDataModeSettings = actualSettings.MissingDataMode;

            rootProcessor.DataReader = reader;
            rootProcessor.CreateDynamicContentTags  = actualSettings.CreateDynamicContentTags;
            rootProcessor.DynamicContentLockingType = actualSettings.DynamicContentLockingType;
            rootProcessor.Process();

            package.ReplaceAltChunks();
        }
コード例 #2
0
        public void GenerateDocx <E>(Stream templateStream, Stream outputStream, E dataEntity, DocxGeneratorSettings settings = null)
        {
            var reader = this.DataReaderFactory.CreateReader(dataEntity);

            this.GenerateDocx(templateStream, outputStream, reader, settings);
        }
コード例 #3
0
        private void GenerateDocx(Stream templateStream, Stream outputStream, DataReader reader, DocxGeneratorSettings settings)
        {
            var actualSettings = settings ?? this.GetDefaultSettings();

            templateStream.Seek(0, SeekOrigin.Begin);
            templateStream.CopyTo(outputStream);

            var package = this.PackageFactory.Create(outputStream);

            package.Load();
            foreach (var part in package.Parts)
            {
                ProcessPackage(reader, part, actualSettings);
            }
            package.Save();
        }
コード例 #4
0
        public void GenerateDocx(Stream templateStream, Stream outputStream, XDocument dataXml, DocxGeneratorSettings settings = null)
        {
            var reader = this.DataReaderFactory.CreateReader(dataXml);

            this.GenerateDocx(templateStream, outputStream, reader, settings);
        }