This is a migrated thread and some comments may be shown as answers.

[Solved] Problem on pasting MS Word Document

3 Answers 232 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Márcio
Top achievements
Rank 1
Márcio asked on 13 Jun 2008, 08:03 PM
Hi.
I´m trying to paste a document from MS Word window in RadEditor control but it´s not pasting the images and basic shapes (circles, squares, etc) from the document.
Is there another way to add an image to the control without having to specify an url in the html code? Something like: serializing the image and embedding it in the code!

Thanks.

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Jun 2008, 04:14 PM
Hello Márcio,

I hope that the following information will make this issue more clear. Here is what I did:

I have created an MS Word document, put some text in it and an image.
I copied the content of the document in the clipboard
I then pasted it in RadEditor and switched to Html view.

Here is what you get when you paste MS Word content (including image) from the clipboard to the editor:

<v:imagedata o:title="17jq" src="
file:///C:\DOCUME~1\Jekov\LOCALS~1\Temp\msohtml1\01\clip_image001.jpg"></imagedata>

As you can see, the src attribute points to a local file, but not to a web server, which is accessible in Internet. If you have sufficient permissions over the appropriate folder, you will be able to see the image. However, if you want this image to be accessible for others in the WEB, you must upload it on a web server so that it has a WEB address (rather than a local address). To do that you can use the File Upload functionality of the Image manager.


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Márcio
Top achievements
Rank 1
answered on 16 Jun 2008, 05:45 PM
Hello Rumen.

Putting the images on web server won´t work out in my case (I mean: it will demand a great effort to do that way).
I´ve been thinking in another approach: embedding the images inside html (multipart html) like describe in http://www.ietf.org/rfc/rfc2557.txt. The same way used in multipart content email.

Here is an email example:

From: foo1atbar.net
To: foo2atbar.net
Subject: A simple example
Mime-Version: 1.0
Content-Type: multipart/related; boundary="boundary-example"; type="text/html"

--boundary-example
Content-Type: text/html; charset="US-ASCII"

... text of the HTML document, which might contain a URI
referencing a resource in another body part, for example
through a statement such as:
<IMG SRC="cid:foo4atfoo1atbar.net" ALT="IETF logo">

--boundary-example
Content-Location: CID:somethingatelse ; this header is disregarded
Content-ID: <foo4atfoo1atbar.net>
Content-Type: IMAGE/GIF
Content-Transfer-Encoding: BASE64

R0lGODlhGAGgAPEAAP/////ZRaCgoAAAACH+PUNv
cHlyaWdodCAoQykgMTk5LiBVbmF1dGhvcml6ZWQgZHV
wbGljYXRpb24gcHJvaGliaXRlZC4A etc...

--boundary-example--

The kind of enconding I wiil try is something described in http://www.faqs.org/rfcs/rfc2397.html

Here is example:

<IMG
SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
hhx4dbgYKAAA7"
ALT="Larry">
Do you know if RadEditor supports that approach?

Thanks.
0
Tervel
Telerik team
answered on 17 Jun 2008, 07:21 AM
Hi Márcio,

The email format is not HTML/XHTML - it provides more capabilities, such as the ability to embed an image or other binary data directly into the email content.

Unfortunately, while it is very convenient, this is not possible to achieve with XHTML.
The most that can be done with HTML is that the editor "detects" that the images pasted have their src pointing to a local computer. Then it can prompt the user to upload them - and after the upload the editor can then change the URL's automatically.

This is a complex, several-step procedure that nonetheless cannot be done purely automatically due to browser security restrictions! No data transfer from the client computer to the server can happen purely programatically, without explicit user authorization - e.g. y clicking on an upload button.

The "detect/prompt user/upload/replace URLs" feature is on our TODO list for RadEditor, but we cannot give you an ETA when it will be implemented.

A purely "seamless" approach - such that you want - is not possible with pure DHTML solution - you will need an alternative technology such as ActiveX or Flash - which provides bigger control over the client computer.


Greetings,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
Márcio
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Márcio
Top achievements
Rank 1
Tervel
Telerik team
Share this question
or