How to save a selected word image to image file in open XML in PNG format?

Hi Everyone,
I have a very strange problem. I want to extract the image from word using open xml sdk. Here the user selects the image on opened word, and then clicks on any button, so it should extract the same selected image to any predefined location in the PNG format.
I also tried to do the same thing using Word API, there I am copying the selection of image to clipboard and then getting the image and converting it to bitmap and saving it, but the image resolution is coming very bad. Is there any method through which
I can save the image to file either by Open XML sdk or Word API using C#.
Thanks,
Shahab Abbasi

Hi Shahab,
To extract images from word document, please take a look at this thread:
https://social.msdn.microsoft.com/Forums/office/en-US/e2a795ea-2ab7-401e-b6a8-0576220553f8/openxml-excel-how-to-extract-only-image-files?forum=oxmlsdk
string fileName = @"C:\test.docx";
using (WordprocessingDocument document = WordprocessingDocument.Open(fileName, true))
var e = document.MainDocumentPart.ImageParts.GetEnumerator();
int picNum = 0;
while (e.MoveNext())
picNum++;
ImagePart imagePart = e.Current;
Stream stream = imagePart.GetStream();
long length = stream.Length;
byte[] byteStream = new byte[length];
stream.Read(byteStream, 0, (int)length);
FileStream fstream = new FileStream(@"C:\abc.jpg", FileMode.OpenOrCreate);
fstream.Write(byteStream, 0, (int)length);
fstream.Close();
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How to save slices selected by the slice-select-tool ?

    How to save slices selected by the slice-select-tool ? In the past, I select several slices in edit window and saved for web(ctrl+alt+shift+s) But now, selected slices are unselected in the Save-for-web dialog except first slice.
    I'm sorry my short english.

    How to save slices selected by the slice-select-tool ? In the past, I select several slices in edit window and saved for web(ctrl+alt+shift+s) But now, selected slices are unselected in the Save-for-web dialog except first slice.
    I'm sorry my short english.

  • How to save the  selected rows from Advance table into database

    Hi
    I have requirement like..
    In custom page , Manager Search the Candidates and selects the candidate ROWS from advance table.
    The reqt is how to save the selected multiple rows into the database.

    hi Reetesh,
    In Custom page
    Supoose the Recruiter Search is for Position Finance Mangager , it retrieves 100 rows , out of which Recruiter select 10 rows .
    So in Such scenario how to save this 10 rows against Recruiter
    , i mean , Is i need to create custom table, to save Recruiter , these selected 10 rows.
    I hope u understand my question

  • How to SAVE a selected Characteristic Restriction

    I'm using BW 7.0.
    How to save a selected Characteristic Restriction so the next time the user access the report he or she can re-use the saved selection?
    For a specific SRM report the user can restrict report result selecting buyers, which can be too many (~200). It’s very important that the user does not have to select each one every time he or she access this report.
    Any tips?
    Thanks in advance.
    Raphael Barboza

    See the description of the new filter option here:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/7e1042197de42ce10000000a1550b0/content.htm
    Under new features:
    New Functional Features
    ●     The filter of a query can be saved as a reusable object.
    Details on this Filter object are here:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/fcf20384631a71e10000000a422035/content.htm
    Make sure you set auth to allow usage of this on auth object S_RS_COMP.

  • How to output 3D Surface Graph as image file (bmp or jpg or png)

    I'd like to output a graph from the 3D surface.vi module as a regular
    image (like a JPG or BMP).  At this time, I'm going through an
    awkward process of taking a screen cap, then isolating the image with
    photoshop (painful and time consuming).
    Any idea or input would be appreciated.

    RIght-click on the graph and "create...invoke node". On the diagram, select method "get image".
    Save the output of "image data" as JPG, BMP, or PNG using the tools from the "Graphics Formats" palette.
    (The code shows would get a 24bit PNG image)
    See how far you get. Good luck!
    Message Edited by altenbach on 08-12-2005 02:50 PM
    Message Edited by altenbach on 08-12-2005 02:51 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    GetImage.png ‏3 KB

  • How to save a single page in a pdf file

    how to save a single page in a pdf file?

    I also need to do this so i can send portions of a large fax file.

  • How do I find the aperture image files so that I can attach them to an email

    How do I find the aperture image files? I know that you can email images from aperture. But how would I attach an image using Mail?

    if you mean to go into the Aperture library in order to get image files to print with Canon's software it's not really possible. The best you would be able to do would be to get the master image and if you're shooting RAW that will be the RAW file. In any case no adjustments you made to the image in Aperture would be available, versions don't exist as files until you export them.
    If you want to print with the Canon software you would export the image from Aperture and then print that image file.
    If I've misunderstood your question post back,
    regards

  • How to transfer a mac document into a pdf file to open on a microsoft computer.

    how to transfer a mac document into a pdf file to open on a microsoft computer.

    Choose to print it, click on PDF, and then Save as PDF.
    (113984)

  • Can't save 24 x 36 ai version 9 file when opened in CS6

    Can’t save 24 x 36 ai version 9 file when opened in CS6, even when opened as an outline format. I was able to save the file when reduced to 8 x 11, once saved I  resized it back to 24 x 36 but it still didn’t work. Any help would be greatly appreciated thanks

    Sorry to have taken up your time, I have figured it out.  I have about 50 layers and one was bad, process of elimination, I deleted one by one till I found the layer that was causing it to fail.  Files I had converted from .DWG to AI coused an error

  • How to save a scan in Image Capture?

    How do I save my scan in image capture?
    What option to I go to save it as a JPEG or PNG to my computer?

    There's no Save command because Image Capture automatically saves scans when you click the Scan button.
    To find the format options, you have to click Show Details at the bottom. This will reveal the save location and format options, including an Overview button so you can test your crop etc. settings before you do the final scan.
    Baby Boomer (USofA) wrote:
    Image Capture>Help>Image Capture Help.
    This suggestion is not very helpful because this information is very difficult to find in the Help. Image Capture doesn't have a "Save" or "Export" command like most apps do, so anyone trying to find this info in Image Capture Help will be frustrated until they eventually dig down and discover the section "Scan images with a flatbed scanner using detailed options." In fact, if someone searches for the term "save" it doesn't even turn up any results, and "JPEG" or "PNG" only turns up results for the digital camera import part of Image Capture, nothing about scanning.
    The Apple help for Image Capture is so incomplete and counter-intuitive that this is one of those times when it's better to answer the question directly then to dump someone into the top level of Help with no guidance.

  • Selecting multiple image files on the 'insert picture' menu in word

    Hi there,
    I am trying to insert multiple pictures at once into a word document, on office for mac 2011.
    I am using the 'insert picture' option from the toolbar. Shift-click doesn't work like on a PC, and i have tried a variety of button combinations that don't seem to have any effect! Is there any way around this so I don't have to insert picture files into a word document one at a time?
    Thanks!

    You are right, it does not work. Here is a workaround by doing an intermediate stopover in TextExit (it's in your Dock and/or in your Applications folder):
    In the Finder, select your multiple image files
    Right-click (or control-click) and select "Copy # items"
    Go to TextEdit and paste
    Do Select All (Command A) followed by Copy (Command C)
    Go back to Word and paste your heart out

  • (mapviewer) how to save map as an image

    I open a mapviewer in web page, and load a map.
    I wonder how to save this map as an image?
    thx
    tamsun

    Hey, I was wondering how I could save my graphics as an image,Don't know if you can save Graphics as an Image, but you can draw a JComponents image to an Image. Search the forum using "screenimage" to find my class that does this.

  • How to save the selected records from Table control in dialog programming

    Hiiiiiiii Every1
    Actually the problem is like this:-
    I have to select some records from table control and then want to save the selected records in DB table.
    Example
    I have some rows having inforamtion bout employees...
    Now what i want is that when i click on 'SAVE' button then these selected rows should be moved into DB table.
    Sachin Dhingra

    see below example, I have added INSERT option after DELETE option.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA cols LIKE LINE OF flights-cols.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
    TABLES demo_conn.
    SELECT * FROM spfli INTO TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
        WHEN 'INSERT'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              itab1 = itab.
              modify itab1.
            ENDLOOP.
          ENDIF.
          if not itab1 is initial.
            INSERT dbtab FROM TABLE itab1.
          endif.
      ENDCASE.
    ENDMODULE.

  • How to save the selection of quick select tool using scripts?

    I am writing a script to record the edit history and I want to save the select area of quick select tool using scripts. 

    Yeah, that's true. If we active the HistoryState, we can see the selection area in  photoshop, however when we save the HistoryState in  jpg, the dotted line disappears. 

  • How to save multi select selection

    Is possible??
    Thank you!!

    As previously said you can do that.
    First you need to create your saved selection to do that go to Page options -- choose "Save Current Selection"- Choose "For Me" Name it example 'xyz' click on ok.
    From now onwards if you want to apply your saved selection 'xyz' then goto page options mouse over on saved selections it will display all available saved selections choose xyz from that. thats it.
    Thanks
    Srinivas

Maybe you are looking for

  • Outlook Web Access - Not Working In Safari

    Not sure if it can be fixed or not. I get the same problem in Camino. When I go to my works Outlook Web Access, I can login and see everything - however the setup is all wrong. There are boxes and files and folders in places that it should not be. It

  • Outlook Integration: unable to create snapshot templates.

    Dear all, I followed all the steps mentioned in note 861055 "You can easily repeat the step of template creation after running the server installation:    1. Start the Addon Outlook Integration from Business one.    2. Choose/Administration/Outlook I

  • WHY DO THE VIDEOS I AM TRYING TO VIEW (YOU TUBE ETC) START AND STOP ALL THE TIME.. I HATE THAT!!!

    Why do the videos that I am trying to view (you tube etc) always start and stop.  it is very annoying and I can't seem to fix it.... thanks for your pointers...  as you can see, I am not a techie.  the fact that numbers, letters and picture appear on

  • SharePoint Workflow HTTP 404 Error

    Hey guys, I'm testing the functionality of workflow manager 1.0 on my SP 2013 SP1 environment. Both installed at the same Windows Server 2012 Standard. I'm able to create and publish a WF using SP designer but when I tested it I got the following err

  • Transfer (IDocs and TRFC): Missing messages or warnings

    Hi, While loading data from ECC to BI, I'm getting the following Error. It is for all DataSources...even for Full loads with 15 records also. Requests (messages): Everything OK Extraction (messages): Missing messages -->Missing message: Request recei