none
problem in use from visio viewer RRS feed

  • Question

  • hi

    i in my project use from visio for dispaly visio file

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.Design;

    namespace IEWebObjects
    {

       
    [ToolboxData("<{0}:ShowVisio runat=server></{0}:ShowVisio>")]
       
    public class ShowVisio : WebControl
       
    {
           
    #region "Declarations"

           
    private string mFilePath;

    #endregion


           
    #region "Properties"

           
    [Category("Source File")]
           
    [Browsable(true)]
           
    [Description("Set path to source file.")]
           
    [Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))]
           
    public string FilePath
           
    {
               
    get
               
    {
                   
    return mFilePath;
               
    }
               
    set
               
    {
                   
    if(value == string.Empty)
                   
    {
                        mFilePath
    = string.Empty;
                   
    }
                   
    else
                   
    {
                       
    int tilde = -1;
                        tilde
    = value.IndexOf('~');
                       
    if(tilde != -1)
                       
    {
                            mFilePath
    = value.Substring((tilde + 2)).Trim();
                       
    }
                       
    else
                       
    {
                            mFilePath
    = value;
                       
    }
                   
    }
               
    }
           
    }   // end FilePath property

    #endregion



           
    #region "Rendering"

           
    protected override void RenderContents(HtmlTextWriter writer)
           
    {
               
               
    try
               
    {
                   
    StringBuilder sb = new StringBuilder();
                    sb
    .Append("<object classid=clsid:279D6C9A-652E-4833-BEFC-312CA8887857 id=vviewer ");
                    sb
    .Append("codebase=http://download.microsoft.com/download/4/5/2/452f8090-413f-408f-83c0-edd66db786ee/vviewer.exe Width = " + 200 + " Height = " + 200 + " > ");
                    sb
    .Append("<param name=SRC value=" + FilePath.ToString() + "> ");
                    sb
    .Append("<param name=HighQualityRender value=1> ");
                    sb
    .Append("<param name=BackColor value=#000000> ");
                    sb
    .Append("<param name=PageColor value=#000000> ");
                    sb
    .Append("<param name=PageVisible value=1> ");
                    sb
    .Append("<param name=AlertsEnabled value=1> ");
                    sb
    .Append("<param name=ContextMenuEnabled value=1> ");
                    sb
    .Append("<param name=GridVisible value=1> ");
                    sb
    .Append("<param name=PropertyDialogEnabled value=1> ");
                    sb
    .Append("<param name=ScrollbarsVisible value=1> ");
                    sb
    .Append("<param name=ToolbarVisible value=1> ");
                    sb
    .Append("<param name=CurrentPageIndex value=1> ");
                    sb
    .Append("<param name=Zoom value=-1> ");
                    sb
    .Append("</object>");

                    writer
    .RenderBeginTag(HtmlTextWriterTag.Div);
                    writer
    .Write(sb.ToString());
                    writer
    .RenderEndTag();
               
    }
               
    catch
               
    {
                   
    // with no properties set, this will render "Display Visio Control" in a
                   
    // a box on the page
                    writer
    .RenderBeginTag(HtmlTextWriterTag.Div);
                    writer
    .Write("Display Visio Control");
                    writer
    .RenderEndTag();
               
    }  // end try-catch
           
    }   // end RenderContents

           
    #endregion

       
    }   // end class
    }       // end namespace

    and in my page load create a instance from it and write this code :

    <cc1:ShowVisio ID="ShowVisio1" runat="server" />

    and

     ShowVisio1.FilePath = @"D:\User\VisioFile\test1.vsd";

    but when run it when open my browser IE ,just show a rectangle empty

    please help me for solve it

    thanks
    Tuesday, July 10, 2012 10:26 AM

Answers