1

I am using visio 2013 drawing control. When I save a file as vsd it is throwing exception "File not found". However file is saved on given location. Since file is saved , I ignore the exception but on reloading the same file it is throwing "Error HRESULT E_FAIL has been returned from a call to a COM component" exception.

Everything is working fine if I used vsdx extension instead of vsd. But I save file as vsd for backward compatibility.

below is the code that all I am doing. I have also tried to set application version to 2010 but nothing is working.

    private void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string fileName = "C:\\test\\mydrawing1.vsd";
            axDrawingControl1.Document.SaveAsEx(fileName, (short)VisOpenSaveArgs.visSaveAsWS);
            //axDrawingControl1.Document.SaveAs(fileName);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

    private void btnReload_Click(object sender, EventArgs e)
    {
        OpenFileDialog op = new OpenFileDialog();
        op.ShowDialog();
        try
        {
            this.axDrawingControl1.Src = op.FileName;
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

    private void btnOpen_Click(object sender, EventArgs e)
    {
        OpenFileDialog op = new OpenFileDialog();
        op.ShowDialog();
        this.axDrawingControl1.Src = op.FileName;
    }
4

1 回答 1

0

这是 visio 2013 绘图控件中的一个错误。参见下面的 KB

http://support.microsoft.com/kb/2900075

于 2014-02-12T08:42:35.157 回答