How to get images from the user selection in word add-in?How do you display code snippets in MS Word preserving format and syntax highlighting?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How do I update the GUI from another thread?Get int value from enum in C#Get property value from string using reflection in C#Detecting text changes in Word 2016 from VSTO add-inHow to prevent combobox firing event when we typing textHow to replace text with a MS Word web add-in by preserving the formatting?Word VBA gets runtime Error 91 with using range.find in Word HeaderC# Word Document, replace selected Range text?

Replacing matching entries in one column of a file by another column from a different file

Is it possible to run Internet Explorer on OS X El Capitan?

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Can I ask the recruiters in my resume to put the reason why I am rejected?

Can a vampire attack twice with their claws using Multiattack?

What's that red-plus icon near a text?

I'm flying to France today and my passport expires in less than 2 months

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

What's the output of a record needle playing an out-of-speed record

What is a clear way to write a bar that has an extra beat?

Do infinite dimensional systems make sense?

Could an aircraft fly or hover using only jets of compressed air?

How is it possible to have an ability score that is less than 3?

Convert two switches to a dual stack, and add outlet - possible here?

How can bays and straits be determined in a procedurally generated map?

Why is consensus so controversial in Britain?

LaTeX: Why are digits allowed in environments, but forbidden in commands?

NMaximize is not converging to a solution

How old can references or sources in a thesis be?

Why does Kotter return in Welcome Back Kotter?

What does "Puller Prush Person" mean?

Malformed Address '10.10.21.08/24', must be X.X.X.X/NN or

infared filters v nd



How to get images from the user selection in word add-in?


How do you display code snippets in MS Word preserving format and syntax highlighting?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How do I update the GUI from another thread?Get int value from enum in C#Get property value from string using reflection in C#Detecting text changes in Word 2016 from VSTO add-inHow to prevent combobox firing event when we typing textHow to replace text with a MS Word web add-in by preserving the formatting?Word VBA gets runtime Error 91 with using range.find in Word HeaderC# Word Document, replace selected Range text?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I need to get the text and images that are selected from the word document. I’m able to get the selected text in the document selection change event. For images I can get the count of selected images but couldn't get either the URL of the image or the byte array of the image.



Below is the method I have used



void ThisDocument_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)

int imageCount = e.Selection.InlineShapes.Count;
if (imageCount > 0)

//Error occurred: Collection doesn’t exist
var img = e.Selection.InlineShapes[0];
System.Windows.Forms.MessageBox.Show("Title" + ss.Title);


if (!string.IsNullOrEmpty(e.Selection.Text))
System.Windows.Forms.MessageBox.Show("The selection in the document has changed." + e.Selection.Text);



How can I resolve this?










share|improve this question
























  • Does InlineShape.Range.EnhMetaFileBits help? It's that, or copy to the clipboard then take it from the clipboard in the format you need.

    – Cindy Meister
    Jun 22 '18 at 10:18












  • var inlineShapeObj = e.Selection.InlineShapes[0]; //Above line I'm trying to get the InlineShape from InlineShape collection.But error occured "The requested member of the collection does not exist." var imgByte = inlineShapeObj.Range.EnhMetaFileBits;

    – Naveen Prasath
    Jun 22 '18 at 11:43











  • Are you sure it's an InlineShape and not a Shape?

    – Cindy Meister
    Jun 22 '18 at 12:09

















0















I need to get the text and images that are selected from the word document. I’m able to get the selected text in the document selection change event. For images I can get the count of selected images but couldn't get either the URL of the image or the byte array of the image.



Below is the method I have used



void ThisDocument_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)

int imageCount = e.Selection.InlineShapes.Count;
if (imageCount > 0)

//Error occurred: Collection doesn’t exist
var img = e.Selection.InlineShapes[0];
System.Windows.Forms.MessageBox.Show("Title" + ss.Title);


if (!string.IsNullOrEmpty(e.Selection.Text))
System.Windows.Forms.MessageBox.Show("The selection in the document has changed." + e.Selection.Text);



How can I resolve this?










share|improve this question
























  • Does InlineShape.Range.EnhMetaFileBits help? It's that, or copy to the clipboard then take it from the clipboard in the format you need.

    – Cindy Meister
    Jun 22 '18 at 10:18












  • var inlineShapeObj = e.Selection.InlineShapes[0]; //Above line I'm trying to get the InlineShape from InlineShape collection.But error occured "The requested member of the collection does not exist." var imgByte = inlineShapeObj.Range.EnhMetaFileBits;

    – Naveen Prasath
    Jun 22 '18 at 11:43











  • Are you sure it's an InlineShape and not a Shape?

    – Cindy Meister
    Jun 22 '18 at 12:09













0












0








0








I need to get the text and images that are selected from the word document. I’m able to get the selected text in the document selection change event. For images I can get the count of selected images but couldn't get either the URL of the image or the byte array of the image.



Below is the method I have used



void ThisDocument_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)

int imageCount = e.Selection.InlineShapes.Count;
if (imageCount > 0)

//Error occurred: Collection doesn’t exist
var img = e.Selection.InlineShapes[0];
System.Windows.Forms.MessageBox.Show("Title" + ss.Title);


if (!string.IsNullOrEmpty(e.Selection.Text))
System.Windows.Forms.MessageBox.Show("The selection in the document has changed." + e.Selection.Text);



How can I resolve this?










share|improve this question
















I need to get the text and images that are selected from the word document. I’m able to get the selected text in the document selection change event. For images I can get the count of selected images but couldn't get either the URL of the image or the byte array of the image.



Below is the method I have used



void ThisDocument_SelectionChange(object sender, Microsoft.Office.Tools.Word.SelectionEventArgs e)

int imageCount = e.Selection.InlineShapes.Count;
if (imageCount > 0)

//Error occurred: Collection doesn’t exist
var img = e.Selection.InlineShapes[0];
System.Windows.Forms.MessageBox.Show("Title" + ss.Title);


if (!string.IsNullOrEmpty(e.Selection.Text))
System.Windows.Forms.MessageBox.Show("The selection in the document has changed." + e.Selection.Text);



How can I resolve this?







c# ms-word add-in






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 0:52









halfer

14.7k759116




14.7k759116










asked Jun 22 '18 at 7:33









Naveen PrasathNaveen Prasath

389117




389117












  • Does InlineShape.Range.EnhMetaFileBits help? It's that, or copy to the clipboard then take it from the clipboard in the format you need.

    – Cindy Meister
    Jun 22 '18 at 10:18












  • var inlineShapeObj = e.Selection.InlineShapes[0]; //Above line I'm trying to get the InlineShape from InlineShape collection.But error occured "The requested member of the collection does not exist." var imgByte = inlineShapeObj.Range.EnhMetaFileBits;

    – Naveen Prasath
    Jun 22 '18 at 11:43











  • Are you sure it's an InlineShape and not a Shape?

    – Cindy Meister
    Jun 22 '18 at 12:09

















  • Does InlineShape.Range.EnhMetaFileBits help? It's that, or copy to the clipboard then take it from the clipboard in the format you need.

    – Cindy Meister
    Jun 22 '18 at 10:18












  • var inlineShapeObj = e.Selection.InlineShapes[0]; //Above line I'm trying to get the InlineShape from InlineShape collection.But error occured "The requested member of the collection does not exist." var imgByte = inlineShapeObj.Range.EnhMetaFileBits;

    – Naveen Prasath
    Jun 22 '18 at 11:43











  • Are you sure it's an InlineShape and not a Shape?

    – Cindy Meister
    Jun 22 '18 at 12:09
















Does InlineShape.Range.EnhMetaFileBits help? It's that, or copy to the clipboard then take it from the clipboard in the format you need.

– Cindy Meister
Jun 22 '18 at 10:18






Does InlineShape.Range.EnhMetaFileBits help? It's that, or copy to the clipboard then take it from the clipboard in the format you need.

– Cindy Meister
Jun 22 '18 at 10:18














var inlineShapeObj = e.Selection.InlineShapes[0]; //Above line I'm trying to get the InlineShape from InlineShape collection.But error occured "The requested member of the collection does not exist." var imgByte = inlineShapeObj.Range.EnhMetaFileBits;

– Naveen Prasath
Jun 22 '18 at 11:43





var inlineShapeObj = e.Selection.InlineShapes[0]; //Above line I'm trying to get the InlineShape from InlineShape collection.But error occured "The requested member of the collection does not exist." var imgByte = inlineShapeObj.Range.EnhMetaFileBits;

– Naveen Prasath
Jun 22 '18 at 11:43













Are you sure it's an InlineShape and not a Shape?

– Cindy Meister
Jun 22 '18 at 12:09





Are you sure it's an InlineShape and not a Shape?

– Cindy Meister
Jun 22 '18 at 12:09












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50982897%2fhow-to-get-images-from-the-user-selection-in-word-add-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50982897%2fhow-to-get-images-from-the-user-selection-in-word-add-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme