Exemplo n.º 1
0
        public void PostStaticResult(StaticQueryResult results)
        {
            Log.Debug("{class} {method} {event}", "WorkbookController", "PostStaticResult", "Start");
            var xl  = new ExcelHelper(Globals.ThisAddIn.Application);
            var sht = xl.GetTargetWorksheet(results.TargetSheet);

            xl.CopyDataTableToRange(results.QueryResults, sht);
            Log.Debug("{class} {method} {event}", "WorkbookController", "PostStaticResult", "End");
        }
Exemplo n.º 2
0
        public void PostStaticResult(StaticQueryResult results)
        {
            if (results == null)
            {
                throw new ArgumentNullException(nameof(results));
            }

            Log.Debug("{class} {method} {event}", "WorkbookController", "PostStaticResult", "Start");
            using (var xl = new ExcelHelper(Globals.ThisAddIn.Application))
            {
                var sht = xl.GetTargetWorksheet(results.TargetSheet);
                ExcelHelper.CopyDataTableToRange(results.QueryResults, sht);
            }
            Log.Debug("{class} {method} {event}", "WorkbookController", "PostStaticResult", "End");
        }
Exemplo n.º 3
0
        public IHttpActionResult PostStaticResult(StaticQueryResult results)
        {
            Log.Debug("{class} {method} {event}", "WorkbookController", "PostStaticResult", "Start");

            if (results == null)
            {
                throw new ArgumentNullException(nameof(results));
            }
            if (results.QueryResults == null)
            {
                return(this.BadRequest("Resultset is null"));
            }
            if (results.QueryResults.Columns.Count == 0)
            {
                return(this.NotFound());                                        // BadRequest("Resultset has no columns");
            }
            using (var xl = new ExcelHelper(Globals.ThisAddIn.Application))
            {
                var sht = xl.GetTargetWorksheet(results.TargetSheet);
                ExcelHelper.CopyDataTableToRange(results.QueryResults, sht);
            }
            Log.Debug("{class} {method} {event}", "WorkbookController", "PostStaticResult", "End");
            return(this.Ok());
        }