1

データベースから Excel シートにデータを取得するカスタマイズされた Excel ユーザー定義関数 ( この関数 ( =getData(A1,B1)) を ac# コードから実行して Excel ファイルのデータを取得すると、ファイルを手動で開くまで実行されずにセルに配置されます。ここに私のコードの一部があります:

var rng = workSheet.Range["A2"];  //where I will put the result table
            try{

            rng.Formula = @"=getData(A1,B1)"; //A1 =Cell from where the function   will get first argument
            String formula = rng.Formula.ToString(); 
            rng.FormulaHidden = false;
            workSheet.Unprotect();
            workBook.SaveAs(filePath, AccessMode: IExcel.XlSaveAsAccessMode.xlExclusive);
            formula = rng.Formula;  
            bool hidden = rng.FormulaHidden;

        }
catch.....
//close opened instances of the Excel file

結果を自動的に生成し、結果が生成されたときに防止されるソリューションはありますか (データベースからデータを取得するのに時間がかかります)

4

0 に答える 0