public async Task <byte[]> GenerateNotificationDocument(Guid notificationId)
        {
            using (var memoryStream = DocumentHelper.ReadDocumentStreamShared("NotificationMergeTemplate.docx"))
            {
                using (var document = WordprocessingDocument.Open(memoryStream, true))
                {
                    var mergeFields = MergeFieldLocator.GetMergeRuns(document);

                    var blocks = await blocksFactory.GetBlocks(notificationId, mergeFields);

                    var notificationDocument = new NotificationDocumentMerger(mergeFields, blocks);

                    var shipmentInfo = await shipmentInfoRepository.GetByNotificationId(notificationId);

                    ShipmentQuantityUnitFormatter.ApplyStrikethroughFormattingToUnits(document, shipmentInfo);

                    notificationDocument.Merge();

                    MergeFieldLocator.RemoveDataSourceSettingFromMergedDocument(document);
                }

                return(memoryStream.ToArray());
            }
        }
Exemple #2
0
 public DocumentGenerator(NotificationDocumentMerger notificationDocumentMerger)
 {
     this.notificationDocumentMerger = notificationDocumentMerger;
 }
 public DocumentGenerator(NotificationDocumentMerger notificationDocumentMerger)
 {
     this.notificationDocumentMerger = notificationDocumentMerger;
 }