private void ImportFromByteArray(byte[] input) { #region radwordsprocessing-formats-and-conversion-docx-docxformatprovider_1 DocxFormatProvider provider = new DocxFormatProvider(); RadFlowDocument document = provider.Import(input); #endregion }
private RadFlowDocument OpenSample() { using (Stream stream = File.OpenRead(TemplatePath)) { DocxFormatProvider docxFormatProvider = new DocxFormatProvider(); return(docxFormatProvider.Import(stream)); } }
private void LoadSampleDocument() { Stream stream = Application.GetResourceStream(new Uri(SampleDocumentPath, UriKind.RelativeOrAbsolute)).Stream; DocxFormatProvider provider = new DocxFormatProvider(); RadDocument document = provider.Import(stream); this.radRichTextBox.Document = document; }
private void RadRichTextBox_Loaded(object sender, RoutedEventArgs e) { using (Stream stream = Application.GetResourceStream(GetResourceUri(SampleDocumentPath)).Stream) { DocxFormatProvider provider = new DocxFormatProvider(); this.radRichTextBox.Document = provider.Import(stream); } }
private void LoadSampleDocument() { Stream stream = Application.GetResourceStream(new Uri(SampleDocumentPath, UriKind.RelativeOrAbsolute)).Stream; DocxFormatProvider provider = new DocxFormatProvider(); RadDocument document = provider.Import(stream); this.radRichTextBox.Document = document; }
private void ImportFromFile() { #region radwordsprocessing-formats-and-conversion-docx-docxformatprovider_0 DocxFormatProvider provider = new DocxFormatProvider(); using (Stream input = File.OpenRead("Sample.docx")) { RadFlowDocument document = provider.Import(input); } #endregion }
public ReportGenerator(string oTemplatePath) { DocxFormatProvider provider = new DocxFormatProvider(); using (Stream input = File.OpenRead(oTemplatePath)) { m_Document = provider.Import(input); m_Editor = new RadFlowDocumentEditor(new RadFlowDocument()); } }
protected RadFlowDocument LoadSampleDocument() { RadFlowDocument document2; IFormatProvider <RadFlowDocument> fileFormatProvider = new DocxFormatProvider(); string fileName = Server.MapPath(templatesFolder + "ΤΙΜ ΕΛΛ 1212 598.docx"); using (FileStream input = new FileStream(fileName, FileMode.Open)) { document2 = fileFormatProvider.Import(input); } return(document2); }
private void OpenWord(string fileName) { var provider = new DocxFormatProvider(); using (Stream input = File.OpenRead(fileName)) { m_Document = provider.Import(input); } m_Filename = fileName; Text = "Calendar Converter - " + fileName; }
public CreateClientLetterTelerik(string sourcePath, string saveAsFile, CashFlowInformation information, CashFlowDetail detail) { this.sourcePath = sourcePath; SaveAsFile = saveAsFile; this.information = information; this.detail = detail; FillStrings(detail); RadFlowDocument wordDocument = new RadFlowDocument(); provider = new DocxFormatProvider(); try { using (Stream input = File.OpenRead(sourcePath)) { 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); int pos = saveAsFile.LastIndexOf("."); string fileName = saveAsFile.Substring(0, pos) + ".docx"; using (Stream output = File.OpenWrite(fileName)) { provider.Export(editor.Document, output); } string pdfFile = fileName.Replace(".docx", ".pdf"); // cpmversion of a flowdocument to a fixeddocument PdfFormatProvider pdfProvider = new PdfFormatProvider(); RadFixedDocument fixedDocument = pdfProvider.ExportToFixedDocument(editor.Document); // write the fixeddocuement to file Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider fixedProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider(); using (Stream output = File.OpenWrite(pdfFile)) { fixedProvider.Export(fixedDocument, output); } }
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); }
private void Initialize() { InitializeComponent(); RadMenuInsertTableItem insertTableBoxItem = new RadMenuInsertTableItem(); this.radDropDownButtonElementTables.Items.Insert(0, insertTableBoxItem); insertTableBoxItem.SelectionChanged += new EventHandler <TableSelectionChangedEventArgs>(OnInsertTableSelectionChanged); this.radMenuItemInsertTable.Click += new EventHandler(radMenuItemInsertTable_Click); ThemeResolutionService.ApplicationThemeName = "Office2010Blue"; this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.Text = "File"; this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.ForeColor = Color.White; this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.DisplayStyle = DisplayStyle.Text; this.radDropDownListFontSize.DropDownStyle = RadDropDownStyle.DropDownList; this.radDropDownListFont.DropDownStyle = RadDropDownStyle.DropDownList; this.radPageView1.SelectedPage = this.radPageViewPageSaveAsWord; DocxFormatProvider docxProvider = new DocxFormatProvider(); RadDocument document = docxProvider.Import(Resources.RichTextBox_for_WinForms); this.AttachDocument(document); this.radRichTextBox1.Document = document; this.radBtnPrintLayout.ToggleState = ToggleState.On; this.radRichTextBox1.CurrentEditingStyleChanged += new EventHandler(radRichTextBox1_CurrentEditingStyleChanged); this.radPageViewPageSaveAsHtml.Item.Click += new EventHandler(this.radBtnSave_Click); this.radPageViewPageSaveAsPDF.Item.Click += new EventHandler(this.radBtnSave_Click); this.radPageViewPageSaveAsRTF.Item.Click += new EventHandler(this.radBtnSave_Click); this.radPageViewPageSaveAsText.Item.Click += new EventHandler(this.radBtnSave_Click); this.radPageViewPageSaveAsWord.Item.Click += new EventHandler(this.radBtnSave_Click); this.radPageViewPageSaveAsXAML.Item.Click += new EventHandler(this.radBtnSave_Click); this.radDropDownListFont.DropDownAnimationEnabled = false; this.radDropDownListFontSize.DropDownAnimationEnabled = false; AttachSignal(); this.closeTimer = new System.Windows.Forms.Timer(); this.closeTimer.Interval = 3000; this.closeTimer.Tick += new EventHandler(closeTimer_Tick); this.closeTimer.Start(); }
public ActionResult ImportDocx() { RadFlowDocument flowDocument; DocxFormatProvider docxProvider = new DocxFormatProvider(); using (Stream input = System.IO.File.OpenRead(Server.MapPath("~/App_Data/Sample.docx"))) { flowDocument = docxProvider.Import(input); } HtmlFormatProvider htmlProvider = new HtmlFormatProvider(); htmlProvider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment; htmlProvider.ExportSettings.StylesExportMode = StylesExportMode.Inline; string html = htmlProvider.Export(flowDocument); return(Content(html)); }
public RadDocument ImportDocx() { RadDocument document = null; txt_Hekate.RichTextBoxElement.BackColor = System.Drawing.Color.Black; IDocumentFormatProvider provider = new DocxFormatProvider(); OpenFileDialog openDialog = new OpenFileDialog(); openDialog.Filter = "Documents|*.hcx"; openDialog.Multiselect = false; DialogResult dialogResult = openDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { using (Stream stream = openDialog.OpenFile()) { txt_Hekate.RichTextBoxElement.Document = provider.Import(stream); txt_Hekate.Focus(); } } return(document); }
private void LawBookPage_Loaded(object sender, RoutedEventArgs e) { //this.radRichTextBox //System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN"); //((DocumentSpellChecker)this.radRichTextBox.SpellChecker).SpellCheckingCulture = new CultureInfo("zh-CN"); //radRichTextBox.Language = using (Stream stream = System.Windows.Application.GetResourceStream(new Uri("/ChongGuanSafetySupervisionQZ.View.WPF;component/Resources/xxx.docx", UriKind.Relative)).Stream) { DocxFormatProvider provider = new DocxFormatProvider(); this.radRichTextBox.Document = provider.Import(stream); } //this.PictureBox_Finger.Image = new Bitmap(@"C:\Users\PETTO\Desktop\102823659548517125.jpg"); //var t = this.radRichTextBox.Document.GetAllBookmarks(); //foreach (var t1 in t) //{ // Debug.WriteLine(t1.Name); //} //this.radRichTextBox.Document.GoToBookmark("bwxAddress"); //StyleDefinition currentSpanStyle = this.radRichTextBox.Document.CaretPosition.GetCurrentSpanBox().AssociatedDocumentElement.Style; ////this.radRichTextBox.Document.Insert("f**k", currentSpanStyle); //this.radRichTextBox.Document.GoToBookmark("endDay"); //this.radRichTextBox.Insert("SHIT"); InsertInfo("year", GlobalData.CurrentTalkingStartTime.Year.ToString()); InsertInfo("startMonth", GlobalData.CurrentTalkingStartTime.Month.ToString()); InsertInfo("startDay", GlobalData.CurrentTalkingStartTime.Day.ToString()); InsertInfo("startHour", GlobalData.CurrentTalkingStartTime.Hour.ToString()); InsertInfo("startMinute", GlobalData.CurrentTalkingStartTime.Minute.ToString()); InsertInfo("endMonth", GlobalData.CurrentTalkingEndTime.Month.ToString()); InsertInfo("endDay", GlobalData.CurrentTalkingEndTime.Day.ToString()); InsertInfo("endHour", GlobalData.CurrentTalkingEndTime.Hour.ToString()); InsertInfo("endMinute", GlobalData.CurrentTalkingEndTime.Minute.ToString()); InsertInfo("wxAddress", GlobalData.NewTalkViewModel.Inquiry.InquiryAddress); InsertInfo("bwxName", GlobalData.NewTalkViewModel.Party.PartyName); InsertInfo("bwxSex", GlobalData.NewTalkViewModel.Party.PartySex); InsertInfo("bwxAge", (DateTime.Now.Year - DateTime.Parse(GlobalData.NewTalkViewModel.Party.PartyBirth).Year).ToString()); InsertInfo("bwxCard", GlobalData.NewTalkViewModel.Party.PartyCard); InsertInfo("bwxAddress", GlobalData.NewTalkViewModel.Party.PartyAddress); InsertInfo("xwrName", GlobalData.NewTalkViewModel.Inquiry.InquiryPoliceName); InsertInfo("xwrNumber", GlobalData.NewTalkViewModel.Inquiry.InquiryPoliceNumber); InsertInfo("talkingType", GlobalData.NewTalkViewModel.Inquiry.InquiryTalkType); InsertInfo("talkingRemark", GlobalData.NewTalkViewModel.Inquiry.InquiryRemarks); StringBuilder sb = new StringBuilder(); foreach (var item in GlobalData.TalkingPageViewModel.MessageList) { sb.AppendLine((item.MessageTypeIsParty ? "回答:" : "提问:") + item.MessageContent); } sb.AppendLine(); InsertInfo("talkingContent", sb.ToString()); //InsertInfo("xwrNumber", GlobalData.NewTalkViewModel.Inquiry.InquiryPoliceNumber); //InsertInfo("xwrNumber", GlobalData.NewTalkViewModel.Inquiry.InquiryPoliceNumber); //InsertInfo("xwrNumber", GlobalData.NewTalkViewModel.Inquiry.InquiryPoliceNumber); //InsertInfo("xwrNumber", GlobalData.NewTalkViewModel.Inquiry.InquiryPoliceNumber); //InsertInfo("endMinute", GlobalData.CurrentTalkingEndTime.Minute.ToString()); //_windowHandle = new WindowInteropHelper(this).Handle; _windowHandle = ((HwndSource)PresentationSource.FromVisual(this)).Handle; HwndSource source = PresentationSource.FromVisual(this) as HwndSource; source.AddHook(WndProc); _homeWindow = (Window.GetWindow(this) as HomeWindow); }
static RadFlowDocument ReadWordDocument(byte[] stream) { var fileFormatProvider = new DocxFormatProvider(); return(fileFormatProvider.Import(stream)); }