在ASP.NET中调用Visio2003

可以参照

ASP.NET 2.0 Visio Custom Control

By salysle

IEWebObjects

 

主要思想如下:

 

代码
         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 =  "   +  Width.Value.ToString()  +   "  Height =  "   +  Height.Value.ToString()  +   "  >  " );
                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

 

 

客户端需要至少安装visio viewer2003

 

你可能感兴趣的:(asp.net)