/// <inheritdoc /> public async Task <MemoryStream> Save() { MemoryStream stream = DocxFilePath.Create(); stream = await Document.WriteInto(stream, "word/document.xml"); stream = await Footnotes.WriteInto(stream, "word/footnotes.xml"); stream = await ContentTypes.WriteInto(stream, ContentTypesInfo.Path); stream = await DocumentRelations.WriteInto(stream, DocumentRelsInfo.Path); stream = await FootnoteRelations.WriteInto(stream, "word/_rels/footnotes.xml.rels"); stream = await Styles.WriteInto(stream, "word/styles.xml"); stream = await Numbering.WriteInto(stream, "word/numbering.xml"); stream = await Theme1.WriteInto(stream, "word/theme/theme1.xml"); foreach (ChartInformation item in Charts) { stream = await item.Chart.WriteInto(stream, $"word/{item.Name}"); } return(stream); }
/// <inheritdoc /> public void Save(DocxFilePath result) { if (result is null) { throw new ArgumentNullException(nameof(result)); } Document.WriteInto(result, "word/document.xml"); Footnotes.WriteInto(result, "word/footnotes.xml"); ContentTypes.WriteInto(result, ContentTypesInfo.Path); DocumentRelations.WriteInto(result, DocumentRelsInfo.Path); FootnoteRelations.WriteInto(result, "word/_rels/footnotes.xml.rels"); Styles.WriteInto(result, "word/styles.xml"); Numbering.WriteInto(result, "word/numbering.xml"); Theme1.WriteInto(result, "word/theme/theme1.xml"); foreach (ChartInformation item in Charts) { item.Chart.WriteInto(result, $"word/{item.Name}"); } }
public void HandleNext(object sender, EventArgs e) { if (handled == 0) { PrimaryTheme = Theme1.GiveCode(); Theme1.Fill = (Brush)(new BrushConverter().ConvertFrom(PrimaryTheme)); SP1Choice1.Text = string.Empty; SP1Choice2.Text = string.Empty; SP1Choice3.Text = string.Empty; SP1Choice4.Text = string.Empty; SP1Choice5.Text = string.Empty; SP1Choice6.Text = string.Empty; SP1Label.Content = "Enter Hash Code for Secondary Theme"; SP1Choice1.Focus(); handled += 1; } else if (handled == 1) { SecondaryTheme = Theme1.GiveCode(); Theme2.Fill = (Brush)(new BrushConverter().ConvertFrom(SecondaryTheme)); SP1Choice1.Text = string.Empty; SP1Choice2.Text = string.Empty; SP1Choice3.Text = string.Empty; SP1Choice4.Text = string.Empty; SP1Choice5.Text = string.Empty; SP1Choice6.Text = string.Empty; SP1Choice1.Visibility = Visibility.Hidden; SP1Choice2.Visibility = Visibility.Hidden; SP1Choice3.Visibility = Visibility.Hidden; SP1Choice4.Visibility = Visibility.Hidden; SP1Choice5.Visibility = Visibility.Hidden; SP1Choice6.Visibility = Visibility.Hidden; handled += 1; } else if (handled == 2) { SP1Label.Content = "Select Company Logo"; Next.Content = "Browse"; handled += 1; } else if (handled == 3) { Microsoft.Win32.OpenFileDialog openFileDlg = new Microsoft.Win32.OpenFileDialog(); openFileDlg.DefaultExt = ".jpeg"; Nullable <bool> result = openFileDlg.ShowDialog(); if (result == true) { var uri = new System.Uri(openFileDlg.FileName); CompanyLogo = uri.AbsoluteUri; ImageSource imgSource = new BitmapImage(uri); Logo.Source = imgSource; Next.Content = "Next"; handled += 1; } } else if (handled == 4) { SP1Label.Content = "Select Promotional Images"; Next.Content = "Browse"; handled += 1; } else if (handled == 5) { Microsoft.Win32.OpenFileDialog openFileDlg = new Microsoft.Win32.OpenFileDialog(); openFileDlg.DefaultExt = ".jpeg"; openFileDlg.Multiselect = true; Nullable <bool> result = openFileDlg.ShowDialog(); if (result == true) { PromotionalImagery = openFileDlg.FileNames; elements = openFileDlg.FileNames.Length; Next.Content = "Save"; handled += 1; } } else if (handled == 6) { SetSetting("PrimaryTheme", PrimaryTheme); SetSetting("SecondaryTheme", SecondaryTheme); SetSetting("CompanyLogo", CompanyLogo); int x = PromotionalImagery.Length; for (int j = 0; j < elements; j++) { SetSetting("PromotionalImagery" + j, PromotionalImagery[j]); } SetSetting("PINum", elements.ToString()); SetSetting("Run", "1"); Application.Current.Shutdown(); } }