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

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page