We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using CKEditor and converting the text into a new word doc and save to DB as blob

We are using CKEditor to edit online resumes and would like to convert the HTML format data to DOC format and save the blob into a database.

Currently we have this

Dim strContent as string
Dim
dstDoc As New Document()
Dim builder As New DocumentBuilder(dstDoc)

strContent=ME.CKEditor1.Text

builder.Writeln(strContent)
Dim stream As New MemoryStream()

dstDoc.Save(stream, SaveFormat.Doc)

then add to database

I know that the saved data is a word doc, but treats the HTML from the CKEditor as text and just saves source code of the HTML, not a HTML data converted to a Word Doc.


Thanks,

mjc

I got it to work by changing the

builder.Writeln(strContent)
to builder.InsertHTML(strContent)

Now, I want to read the BLOB from database which is in a word doc format and return it as HTML code in a string so I can populate the CKEditor.
Thanks,
mjc

So, I think I found my own answer.


Dim filename As String = reader(“FileName”).ToString()
Dim buffer As Byte() = DirectCast(reader(“Content”), Byte())
Dim newStream As New MemoryStream(Buffer)
Dim doc As New Document(newStream)
Dim stream As New MemoryStream()
doc.Save(stream, SaveFormat.Html)
CKEditor1.Text = Encoding.ASCII.GetString(stream.ToArray())

thanks,
mjc

Hi Chris,


Thanks for your inquiry. It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,