【问题标题】:C# How can I Coppy All Things in RichTextBox?C# 如何复制 RichTextBox 中的所有内容?
【发布时间】:2018-10-06 15:37:42
【问题描述】:

我有一个richTextBox,我添加了文本和图像。文字的颜色和字体不一样。我想转换为 doc 文件的所有内容。我正在使用此代码。

wordeaktar.Application wordapp = new wordeaktar.Application(); 
wordapp.Visible = true; 
wordeaktar.Document worddoc; 
object wordobj = System.Reflection.Missing.Value; 
worddoc = wordapp.Documents.Add(ref wordobj); 
wordapp.Selection.TypeText(richTextBox1.Text);
wordapp = null;

enter image description here

这是我的richTextBox 的图像。我该怎么做?

【问题讨论】:

  • richTextBox1.SelectAll(); richTextBox1.Copy(); worddoc.Range().Paste();。但是,如果您只是 richTextBox1.SaveFile("...", RichTextBoxStreamType.RichText),Word 会非常满意。
  • 你是王者!!!

标签: ms-word richtextbox data-conversion


【解决方案1】:

@Gserg的答案是对的!

"richTextBox1.SelectAll();richTextBox1.Copy();worddoc.Range().Paste();。但是如果你只是richTextBox1.SaveFile("...", RichTextBoxStreamType.RichText), Word会非常高兴的。-GSerg"

【讨论】:

    猜你喜欢
    • 2019-10-03
    • 1970-01-01
    • 2013-04-18
    • 2022-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多