예제 #1
0
        private void MergeDocuments(RadFlowDocument document, RadFlowDocument sourceDocument)
        {
            #region radwordsprocessing-model-radflowdocument_3
            document.Merge(sourceDocument);
            #endregion

            #region radwordsprocessing-model-radflowdocument_4
            MergeOptions mergeOptions = new MergeOptions();
            mergeOptions.ConflictingStylesResolutionMode = ConflictingStylesResolutionMode.RenameSourceStyle;

            document.Merge(sourceDocument, mergeOptions);
            #endregion
        }
예제 #2
0
 private void MergeDocuments()
 {
     #region radwordsprocessing-editing-clone-and-merge_0
     RadFlowDocument target = new RadFlowDocument();
     RadFlowDocument source = new RadFlowDocument();
     //...
     // target will contain merged content and styles.
     target.Merge(source);
     #endregion
 }
예제 #3
0
 private void MergeDocumentsWithOptions()
 {
     #region radwordsprocessing-editing-clone-and-merge_1
     RadFlowDocument target = new RadFlowDocument();
     RadFlowDocument source = new RadFlowDocument();
     //...
     MergeOptions mergeOptions = new MergeOptions()
     {
         ConflictingStylesResolutionMode = ConflictingStylesResolutionMode.RenameSourceStyle
     };
     target.Merge(source, mergeOptions);
     #endregion
 }
예제 #4
0
        private void ReplaceWordContent(CashFlowInformation information)
        {
            DirectoryInfo directoryInfo = DirectoryHelper.GetWordTemplateDirectory();

            string source = Path.Combine(directoryInfo.FullName, information.WordDocument);

            foreach (CashFlowDetail detail in information.InvestorDetails)
            {
                FillStrings(detail);
                RadFlowDocument wordDocument = new RadFlowDocument();
                try
                {
                    using (Stream input = File.OpenRead(source))
                    {
                        wordDocument = provider.Import(input);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception($"Das Word-Template konnte nicht geöffnet werden. {ex.Message}");
                }

                editor = new RadFlowDocumentEditor(wordDocument);
                ReplacePlaceholder(detail);

                //add docuemnt to seriesDocument
                seriesDocument.Merge(editor.Document);

                // save single file
                string fileName = DirectoryHelper.FindInvestorCashFlow(detail.Investor.Id, cashFlowNumber);

                using (Stream output = File.OpenWrite(fileName))
                {
                    provider.Export(editor.Document, output);
                }
                eventAggregator.GetEvent <StatusBarEvent>().Publish($"Das Ausschüttungsschreiben für {detail.Reference} wurde erstellt.");
                detail.FileName = fileName;
            }

            string seriesFileName = DirectoryHelper.FindFundCashFlow(information.Fund.Id, cashFlowNumber);

            using (Stream output = File.OpenWrite(seriesFileName))
            {
                provider.Export(seriesDocument.Document, output);
            }

            CommonProcesses.StartWord(seriesFileName);
        }