无法将xhtml渲染为页面

时间:2022-02-26 19:38:16

I am trying to render xhtml from cute editor output to display rich text in my page. I'm trying this but it doesn't seem to be working for me.

我试图从可爱的编辑器输出中呈现xhtml,以在我的页面中显示富文本。我正在尝试这个但它似乎并不适合我。

//ce_Document is my instance of cute editor
public void btn_SaveMessage_Click(object sender, EventArgs e)
{
    XhtmlTextWriter xtw = new XhtmlTextWriter(System.IO.TextWriter.Null);
    xtw.Write(ce_Document.XHTML);
}

1 个解决方案

#1


Looks like you're rendering your text directly to the recycle bin (TextWriter.Null)

看起来你正在将文本直接渲染到回收站(TextWriter.Null)

You should write to the output stream of the response you're generating. Try this (don't know if it compiles)

您应该写入正在生成的响应的输出流。试试这个(不知道是否编译)

XhtmlTextWriter xtw = XhtmlTextWriter(new TextWriter(Response.OutputStream));

#1


Looks like you're rendering your text directly to the recycle bin (TextWriter.Null)

看起来你正在将文本直接渲染到回收站(TextWriter.Null)

You should write to the output stream of the response you're generating. Try this (don't know if it compiles)

您应该写入正在生成的响应的输出流。试试这个(不知道是否编译)

XhtmlTextWriter xtw = XhtmlTextWriter(new TextWriter(Response.OutputStream));