Draw an visio shape as an .vdx file and render the same in a IE browser

I had generated an Visio Diagrams getting input from the excel file and stored it in an local path.
private void DynamicVisio_Load(object sender, EventArgs e)
            string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= 'c:\\Test\\FullData3.xls';Extended Properties='Excel 8.0;HDR=Yes;'";
            string sQuery = "select * from [Customer1_Server$] order by Name";
            DataSet objExcelDS = new DataSet();
            OleDbDataAdapter objDA = new OleDbDataAdapter(sQuery, strConn);
            objDA.Fill(objExcelDS);
            double dblX1 = 0.5d;
            double dblY1 = 10.3d;
            double dblX2 = 2.258d;
            double dblY2 = 6.8d;
            String sText = "";
            String sFilePath = "";
            String sDisk = "";
            String[] sArray;
            String[] separators = { "," };
            String sPicturePath = "C:\\Test\\test.png";
            String sIPRangeValue = "";
            Visio.Application objVApp = new Microsoft.Office.Interop.Visio.Application();
            objVApp.Documents.Add(@"C:\Test\CustomTemplate\ServerTemplate.vsd");// add a document
            for (int i = 0; i < objExcelDS.Tables[0].Rows.Count; i++)
                Visio.Page objVAPage = objVApp.ActiveDocument.Pages.Add();
                objVApp.Documents.Add(@"C:\Test\CustomShapes\MyShapes.vss");// add a document
                Visio.Document objVADoc = objVApp.ActiveDocument;// set the working  document to our new document
                Visio.Masters objVMasters = objVADoc.Masters;
                Visio.Master objVMaster = objVMasters.get_ItemU("CustomTab");
                Visio.Shape objTabShape = objVAPage.Drop(objVMaster, 8.24d, 5.54d);
                objTabShape.Text = objExcelDS.Tables[0].Rows[0]["VLAN"].ToString(); ;
                //set the Shape Width
                objTabShape.get_CellsSRC(
                        (short)Microsoft.Office.Interop.Visio.VisSectionIndices.
                        visSectionObject,
                        (short)Microsoft.Office.Interop.Visio.VisRowIndices.
                        visRowXFormIn,
                        (short)Microsoft.Office.Interop.Visio.VisCellIndices.
                        visXFormWidth).ResultIU = 16.0;
                //set the shape height
                objTabShape.get_CellsSRC(
                   (short)Microsoft.Office.Interop.Visio.VisSectionIndices.
                   visSectionObject,
                   (short)Microsoft.Office.Interop.Visio.VisRowIndices.
                   visRowXFormIn,
                   (short)Microsoft.Office.Interop.Visio.VisCellIndices.
                   visXFormHeight).ResultIU = 10.6;
                Visio.Shape objOuterBox = objVAPage.DrawRectangle(dblX1, dblY1, dblX2, dblY2); // Outer Rectange
                sFilePath = "C:\\Temp\\ServerTemplate"+i.ToString()+".vsd";
                objVApp.ActiveDocument.SaveAsEx(@sFilePath, (short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visSaveAsWS);
but I need to generate the same visio diagram over the web application using the Response.ContentType. ie.
context.Response.ContentType = "application/vdx.visio";
context.Response.AddHeader("content-disposition", String.Format("attachment;filename=\"{0}.vdx\"", fileName));
Pls give me an idea about it along with any example if possible.
Thank you.

Hi,
This Visio forum is for general questions. Since your issue is related to developing, I advise you to post this issue on Office for Developer forum.
https://social.msdn.microsoft.com/Forums/office/en-US/home?category=officedev
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners
who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Best regards,
Greta Ge
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs.

Similar Messages

  • Want to update a text file and reflect the same on iview immediately

    Dear friends,
    I have a text file in a repository path
    I could read each line and do some task.
    My query is for each line task, i would like to update a file (for me it is log file) and reflec the same on a iview in the same page
    sample code appreciated
    regards
    Kantha

    If the user backs up their device to either iCloud or Mac/PC, they can restore the app data from that backup.
    There's no need to do what you intend.

  • Code to pickup app.server file and Email the same!!!

    Hi,
    I need to write an ABAP code to pickup a file in application server and Email the same file to the intended receipients--
    Can i get the code pls?

    Hi Simran,
    Please search the forum. There are many sample codes available for reading data in application server and mail sending.
    User statements OPEN DATASET, READ DATASET and CLOSE DATA SET to get the application server data. Check F1 on these. You will come to know many interesting things.
    Below is the sample code for mail sending.
    DATA: li_reclist  TYPE STANDARD TABLE OF somlreci1,
          li_objpack  TYPE STANDARD TABLE OF sopcklsti1,
          li_content  TYPE STANDARD TABLE OF solisti1,
          lwa_reclist TYPE somlreci1,
          lwa_objpack TYPE sopcklsti1,
          lwa_content TYPE solisti1,
          lwa_doc     TYPE sodocchgi1,
          l_lines     TYPE i.
    REFRESH: li_reclist[], li_objpack[],
             li_content[].
    CLEAR: lwa_reclist, lwa_objpack,
           lwa_content, lwa_doc.
    lwa_reclist-receiver = "Give ur mail ID here.
    lwa_reclist-rec_type = 'U'.
    APPEND lwa_reclist TO li_reclist.
    "Here Loop at ur internal table and populate the data
    lwa_content = 'Please Check with your sales team for more details'.
    APPEND lwa_content TO li_content.
    CLEAR l_lines.
    DESCRIBE TABLE li_content LINES l_lines.
    READ TABLE li_content INTO lwa_content INDEX l_lines.
    lwa_doc-doc_size = ( l_lines - 1 ) * 255 + STRLEN( lwa_content ).
    lwa_doc-obj_langu  = 'E'.
    CONCATENATE 'Sales order' vbak-vbeln 'deleted.' INTO lwa_doc-obj_descr
             SEPARATED BY space.
    CLEAR lwa_objpack-transf_bin.
    lwa_objpack-head_start = 1.
    lwa_objpack-head_num = 0.
    lwa_objpack-body_start = 1.
    lwa_objpack-body_num = l_lines.
    lwa_objpack-doc_type = 'RAW'.
    APPEND lwa_objpack TO li_objpack.
    *Sending the mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA                    = lwa_doc
    *   PUT_IN_OUTBOX                    = ' '
       COMMIT_WORK                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      =
    *   NEW_OBJECT_ID                    =
      TABLES
        PACKING_LIST                     = li_objpack
    *   OBJECT_HEADER                    =
    *   CONTENTS_BIN                     =
       CONTENTS_TXT                     = li_content
    *   CONTENTS_HEX                     =
    *   OBJECT_PARA                      =
    *   OBJECT_PARB                      =
        RECEIVERS                        = li_reclist
    EXCEPTIONS
       TOO_MANY_RECEIVERS               = 1
       DOCUMENT_NOT_SENT                = 2
       DOCUMENT_TYPE_NOT_EXIST          = 3
       OPERATION_NO_AUTHORIZATION       = 4
       PARAMETER_ERROR                  = 5
       X_ERROR                          = 6
       ENQUEUE_ERROR                    = 7
       OTHERS                           = 8
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Thanks,
    Vinod.

  • Issue : Read a text file and print the same

    Hi, My requirement is to read a text file and print it the same way.
    import java.io.BufferedReader;
    import java.io.FileReader;
    public class CatFile {
    public static void main(String[] args) throws Exception
         FileReader file = new FileReader("D:/Test/Allfiles.txt");
         BufferedReader reader = new BufferedReader(file);
         String text = "";
         String line = reader.readLine();
         while (line != null)
              text += line;
              line = reader.readLine();
         System.out.println(text);
    The text file i used contains
    A
    B
    C
    but my output is ABC.
    What change should be made to print it the same way in the txt file ?

    Hi EJP,
    I modified the code based on your suggestion and now its working as expected. Thanks
    Modified code :
    import java.io.BufferedReader;
    import java.io.FileReader;
    public class CatFile {
    public static void main(String[] args) throws Exception
         FileReader file = new FileReader("D:/Test/Allfiles.txt");
         BufferedReader reader = new BufferedReader(file);
         String text = "";
         String line = reader.readLine();
         while (line != null)
              System.out.println(line);
              line = reader.readLine();
              text += line;
    }

  • When I open iTunes on my new computer using the .itl file, and using the same external drive holding the songs, all of the songs I added to iTunes up to a certain date have broken links, while none of the songs have broken links on the old computer.

    I want to open the  iTunes library on my new laptop with all the playlists and stuff I built on the old computer. I have all my music on an external drive. I have copied the .itl file from the old computer and opened it on the laptop, and it has all the playlists, but all of the songs that were added to iTunes up to a certain date have broken links. What am I doing wrong?

    Moving library files around while leaving the data in the same place usually presents no problems. Moving the data around independently from the library usually breaks things. With Windows machines all you should need to do is make sure that the same drive letter is being used on the new system as with the old. If that is not possible you need to get your library into a portable layout before moving it between systems.
    Typical layout of iTunes folders:
    When the media folder is inside the main iTunes folder as shown above then the library is portable. Typically with a split library the iTunes Music or iTunes Media folder (everything inside the red outline) is moved to a different drive by choosing a new locaton for it and then consolidating.
    To make the library portable again you need to copy the library files and album artwork folder into the parent folder of the media folder so that the nested relationship is recreated. (BTW If your media isn't already inside your designated media folder then you will also need to consolidate the files that are outside of it, before you copy the library files.) You can then use the hold-down-shift-when-starting-iTunes method to open the library file in that parent folder. Once the library has been opened, tested and closed you are most of the way there.
    The iTunes window inherits its title from the folder holding the library files so, unless you created a folder called iTunes to hold the media folder, iTunes may now have an unexpected title when you run it. The parent folder can be renamed as iTunes, and the library opened again. Alternatively, if the parent folder is at the root of the drive, or has other data which you wish to leave in place, you can create a new top level folder called iTunes and move the library files, album artwork and media folders into it before opening and testing the library again.
    If the library doesn't work after any step simply reverse it by undoing a move or rename or opening the previous set iTunes Library.itl file.
    If all has gone well then the library is now portable. Once you've migrated the data to a new system you can copy the library files back to their usual internal location if you find that having them on the external drive affects performance...
    tt2

  • Convert XML to text file and sending the same via Mail receiver adapter

    Dear All,
    I have a requirement like....
    I am getting a XML file as a result of mapping and it needs to be converted to a TEXT file and
    the converted file needs to be sent to a mail address in text format.
    Any body has idea how to achieve this?
    Thanks in advance for your help.
    Regards
    Hari

    >
    HP CReddy wrote:
    > Dear All,
    >
    > I have a requirement like....
    >
    > I am getting a XML file as a result of mapping and it needs to be converted to a TEXT file and
    > the converted file needs to be sent to a mail address in text format.
    >
    > Any body has idea how to achieve this?
    >
    > Thanks in advance for your help.
    >
    > Regards
    > Hari
    use the StructXML2Plain or XML2Plain from the standard MessageTransformBean
    Add the module to you Mail adapter before the mail adapters standard module itself
    Ref: http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm

  • Why do I get a NI-488 error massage when writing into a file and at the same time copiyng this file with a backup softwarre like Easy2Sync?

    I have a small LabVIEW program which writes random numbers very fast into a ASCII-file. I want that file to be copied to a new position every 10 min. Therefor I use a backup/synchronisation software which is doing a copy operation every 10 min. It works fine a certian amount of time and after a while I get either an LabVIEW error (LabVIEW: Fiel already open: NI-488 Comand requieres GPIB Controller to be System controller) or an backup-software error (couldn´t open file...whatever). I´m guessing, it has something to do with file-access but I don´t know why?!? If I run the LabVIEW program and I copy and paste the random-number-file with the windows explorer very fast (pressing ctrl+v rapidly) while LabVIEW is still writing into this file, no error appears. Can sombody help me?
    LabVIEW 2011

    Hi Serdj,
    you don't get a GPIB error, the error number has just 2 different explanations...
    Well, you have two programs accessing the same file. One program just wants to make a copy, the other (LabView) is trying to write to the file. When copying a file that is written to you get inconsistent results! That's why one of both programs is complaining an error...
    You can't have write and read access at the same time! (But you can have more than one read access at the same time...)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Way to close/reopen file and keep the same desktop position

    When closing a Text Edit document, I would like to have it reopen in the exact same position on the desktop as when I closed it. Is there any way to make this happen? It seems to remember if the window was resized, but it always puts the document at the bottom of the desktop.

    I have no idea why it isn't working for you. All of Apple's apps use that feature. You might want to launch Disk Utility, select your boot volume, and repair permissions. If that doesn't fix things, create another admin user account, log into it, and see if the problem persists. If so, report back. If not, then the original account's has problems (conflicts, corrupted preferences, or cache file problems). Preferential Treatment can examine the preferences and there's other products that will clean the cache files, but I don't use any, so I have no recommendations.

  • I have no contacts in my outlook contacts file, only in the icloud contacts file and also the same for the outlook calender. I need to synch with a blackberry for both, how do i restore it back?

    I have just set up icloud but now have no outlook contacts or calander, only icloud contacts and calender. I need to synch both to a blackberry so how do i restore the original contacts and calander so I can I can synch normally again?

    Try:                                               
    - iOS: Not responding or does not turn on           
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable                     
    - Try on another computer                                                       
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar
    The missing apps could have been done by setting the Restrictions that can hid those apps. If the backup was made with those retrictions set the the Restrictions are also restored.
    Thus, if you get it to work restore to factory settings/new iPod, not from backup                               
    You can redownload most iTunes purchases by:        
      Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Graph drawing - drawing an arc to and from the same node, how??

    Hey everyone
    This is probably going to have an easy solution but I really cant figure it out!! The problem is drawing a loop in a state machine, ie a path to and from the same node therefore a loop!
    Is there a way to actually do this?
    Thanks in advance!

    Graphics.drawArc(left, top, width, height, start, span) where start is the start angle in degrees, and span is the number of degrees of arc. Assuming you're like me, you're probably putting in the end angle rather than the span.
    Here's one I made earlier- http://www.metamodelling.net/files/ReflexiveArc.java - steps through nine common placements for a circular reflexive arc.
    Pete

  • To upload a RTF and a PDF file to SAP R/3 and print the same through SAP

    Hi,
    I have a requirement to upload a PDF file and a RTF file to SAP R/3 and print the same.
    I wrote the following code for uploading a RTF file to SAP R/3 and print the same. However, the problem is , the formatting present in the RTF document( bold/italics..etc) is not being reflected when I do the 'print-preview' after the executing the code below :
    report z_test_upload .
    data: begin of itab occurs 0,
             rec type string,
          end of itab.
    data: options like itcpo.
    data: filename type string,
          count type i.
    data: filetype(10) type c value 'ASC'.
    DATA: HEADER  LIKE THEAD    OCCURS   0 WITH HEADER LINE.
    DATA: NEWHEADER  LIKE THEAD    OCCURS   0 WITH HEADER LINE.
    DATA: ITFLINE LIKE TLINE    OCCURS   0 WITH HEADER LINE.
    DATA: RTFLINE LIKE HELP_STFA OCCURS   0 WITH HEADER LINE.
    DATA:   string_len TYPE i,
            n1 TYPE i.
    selection-screen begin of block b1.
      parameter: p_file1(128) default 'C:\test_itf.rtf'.
    selection-screen end of block b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      CALL FUNCTION 'F4_FILENAME'
           IMPORTING
                file_name = p_file1.
    start-of-selection.
    move p_file1 to filename.
    call function 'GUI_UPLOAD'
         EXPORTING
              filename                = filename
              filetype                = filetype
         TABLES
              data_tab                = itab
         EXCEPTIONS
              file_open_error         = 1
              file_read_error         = 2
              no_batch                = 3
              gui_refuse_filetransfer = 4
              invalid_type            = 5
              no_authority            = 6
              unknown_error           = 7
              bad_data_format         = 8
              header_not_allowed      = 9
              separator_not_allowed   = 10
              header_too_long         = 11
              unknown_dp_error        = 12
              access_denied           = 13
              dp_out_of_memory        = 14
              disk_full               = 15
              dp_timeout              = 16
              others                  = 17.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    loop at itab.
      string_len = strlen( itab-rec ).
      n1 = string_len DIV 134.
      ADD 1 TO n1.
      DO n1 TIMES.
        rtfline-line = itab-rec.
        APPEND rtfline.
        SHIFT itab-rec BY 134 PLACES.
      ENDDO.
    endloop.
    HEADER-TDSTYLE = 'S_DOCUS1'.
    HEADER-TDFORM = 'S_DOCU_SHOW'.
    header-tdspras = 'E'.
    CALL FUNCTION 'CONVERT_TEXT'
      EXPORTING
      CODEPAGE               = '0000'
        DIRECTION              = 'IMPORT'
        FORMAT_TYPE            = 'RTF'
       FORMATWIDTH            = 72
        HEADER                 = header
        SSHEET                 = 'WINHELP.DOT'
        WITH_TAB               = 'X'
        WORD_LANGU             = SY-LANGU
        TABLETYPE              = 'ASC'
      TAB_SUBSTITUTE         = 'X09  '
      LF_SUBSTITUTE          = ' '
      REPLACE_SYMBOLS        = 'X'
      REPLACE_SAPCHARS       = 'X'
      MASK_BRACKETS          = 'X'
      IMPORTING
        NEWHEADER              = NEWHEADER
      WITH_TAB_E             =
      FORMATWIDTH_E          =
      TABLES
        FOREIGN                = RTFLINE
        ITF_LINES              = ITFLINE.
      LINKS_TO_CONVERT       =
    if sy-subrc <> 0.
    endif.
    CALL FUNCTION 'PRINT_TEXT_ITF'
      EXPORTING
         HEADER        = newheader
         OPTIONS       = options
    IMPORTING
      RESULT        =
      TABLES
        LINES         = itfline.
    if sy-subrc <> 0.
    endif.
    Any hints or suggestions to solve this problem will be highly appreciated.
    Thanks,
    Avra

    Hi Vishwas,
    Check out the thread [Efficient way of saving documents uploaded|Re: Efficient way of saving documents uploaded by users; and check the blog by Raja Thangamani.
    Also check the thread [Export Images through Function Modules   |Export Images through Function Modules;.
    Hope it helps you.

  • I am trying to install software for iTwin Connect, but after downloading the dmg file and launching the program, I receive a message saying the file can't open and to check my internet connection.  Any ideas?

    I am trying to install software for iTwin Connect, but after downloading the dmg file and launching the program, I receive a message saying the file can't open and to check my internet connection.  Any ideas?

    Many Thanks, Kurt.
    I knew I'd seen the solution you've provided somewhere - either in MacWorld or MacFormat - but couldn't remember the Gatekeeper bit!
    I shall save it somewhere VERY safe now in case this happens again …
    You have made an old man very happy and saved me from worrying that senile decay had suddenly set in. (I was 70 last week so you might understand the situation from that.)
    Best wishes
    OllyanDinah

  • While generating reports in Oracle BI Publisher in pdf format, the generated pdf reports have hindi  इ matra displaced by one character. For example, रिपोर्ट is printed as रपेिोरट.  Word file generated of the same report have correct hindi इ  matra positi

    While generating reports in Oracle BI Publisher in pdf format, the generated pdf reports have hindi  इ matra displaced by one character. For example, रिपोर्ट is printed as रपेिोरट.  Word file generated of the same report have correct hindi इ  matra position and also pdf generated from this word file also contains the same.

  • We have developed a desktop application using Flash software and published the same for MAC environment. When we double click on the index.app file, the application is working perfectly in Mac 10.6.7 at our office. But if the same index.app file is double

    We have developed a desktop application using Flash software and published the same for MAC environment. When we double click on the index.app file, the application is working perfectly in Mac 10.6.7 at our office. But if the same index.app file is double clicked in Mac 10.6.7 at out clients location, its not opening. For your information the client is able to open this same application by double clicking on index.swf file. The main problem is that client is not able to open the application using index.app file at their office whereas we are able to do so at our office. Can anyone give some suggestions to sort this problem?

    The most common reason is different versions of Flash, or different versions of web browsers used.  Some users may elect to not have Flash installed at all because of the processor overhead of Flash.  If you are going to make an application for a client, check what operating system and browser versions they are using first.  Then determine if a stand alone application is required, or if they have the necessary plugins to run specific browser enhanced code.
    P.S. MAC is an acronym for Media Access Control.  Mac is the shorthand for Macintosh, the operating system and computers made by Apple Inc.

  • I need help. My ipad 2 was stuck in recovery mode. i tried to connect it to itunes and restore but after downloading the file and extracting the software there is a pop up message that says "the device is full" i dont know what to do. Its been 2 days now.

    I need help. My ipad 2 was stuck in recovery mode. i tried to connect it to itunes and restore but after downloading the file and extracting the software there is a pop up message that says "the device is full. Deleting files and emptying your recycle been will help you restore." how am i going to erase files if i can't open my ipad. i dont know what to do. Its been 2 days now. please help. thanks.

    yes i am sure. This are the exact words... "The iPad "iPad" could not be restored. The disk you are attempting to use is full. (Removing files and emptying the recycle bin will free up additional space". i tried some options, hard reset, redsnow, tinyumbrella but still it's stuck.

Maybe you are looking for