none
Determining clipboards HTML format RRS feed

  • Question

  • I need to extract data from a richtext contentcontrol in HTML format. Since there is no direct method to achieve the same, I am using the Clipboard as an intermediate component. However there have been instances when the clipboard returns a <img src="photo\\path"> for images and sometimes <v:imagedata src="photo\\path"> for the image content. I am not sure why this format change occurs. Is there any rule to it?

    PS: My code goes somehow like this

    //Get the contents into the clipboard

    contentControl.Range.Copy()

    //Get HTML format

    if (Clipboard.ContainsData(DataFormats.Html))

    Clipboard.GetText(TextDataFormat.Html)




    Rahul Lohia. Software Developer. Microsoft Technologies.

    Thursday, January 31, 2013 9:37 AM

Answers

  • Excuse me for the confusion :

    One document was converted to Microsoft.Office.Tools.Word.Document
    the other remained a Microsoft.Office.Interop.Word.Document;

    Thought should let you know :)


    Rahul Lohia. Software Developer. Microsoft Technologies.

    • Marked as answer by lohiarahul Friday, February 22, 2013 2:03 PM
    Friday, February 22, 2013 2:03 PM

All replies

  • Hi lohiarahul,

    Thanks for posting in the MSDN Forum.

    Would you please show me the steps to reproduce the scenario which can get <v:imagedata src="***"> for your issue.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 1, 2013 6:47 AM
    Moderator
  • Hi,

    The code that I have written is pretty much it. I was working on that thing on an independent addin at first which returned me a <img> tag.

    However when I used the same code in my project, it returned <v:imagedata> tag. I changed nothing.

    The only difference in both the scenarios was that in my project the document was password protected with the following command

    Application.ActiveDocument.Protect(WdProtectionType.wdAllowOnlyReading, missing, password, missing, missing);

    and the user had access to the specific controls with

    contentControl.Range.Editors.Add(InteropWord.WdEditorType.wdEditorCurrent);


    Rahul Lohia. Software Developer. Microsoft Technologies.


    • Edited by lohiarahul Friday, February 1, 2013 7:00 AM
    Friday, February 1, 2013 6:58 AM
  • Excuse me for the confusion :

    One document was converted to Microsoft.Office.Tools.Word.Document
    the other remained a Microsoft.Office.Interop.Word.Document;

    Thought should let you know :)


    Rahul Lohia. Software Developer. Microsoft Technologies.

    • Marked as answer by lohiarahul Friday, February 22, 2013 2:03 PM
    Friday, February 22, 2013 2:03 PM