示例#1
0
        public override void ExportImpl(Window parentWindow, Data.DataMatrix matrix, string datasetName, object optionsObj)
        {
            ExcelExporterOptions options = optionsObj as ExcelExporterOptions;

            if (options == null) {
                return;
            }

            ProgressStart("Exporting...");

            int totalRows = matrix.Rows.Count;

            if (FileExistsAndNotOverwrite(options.Filename)) {
                return;
            }
            FileInfo file = new FileInfo(options.Filename);

            using (SQLiteExporterService service = new SQLiteExporterService(file.FullName)) {
                service.CreateTable("ExportedData", matrix);

                service.BeginTransaction();
                int count = 0;
                foreach (MatrixRow row in matrix) {
                    service.InsertRow("ExportedData", row);
                    if (++count % 1000 == 0) {
                        double percent = ((double)count / (double)totalRows) * 100.0;
                        ProgressMessage(String.Format("Exporting {0} rows of {1}...", count, totalRows), percent);
                    }
                }
                ProgressMessage(String.Format("Saving...", count, totalRows));
                service.CommitTransaction();
            }

            ProgressEnd(String.Format("{0} rows exported.", totalRows));
        }
        public override void ExportImpl(Window parentWindow, Data.DataMatrix matrix, string datasetName, object optionsObj)
        {
            ExcelExporterOptions options = optionsObj as ExcelExporterOptions;

            if (options == null)
            {
                return;
            }

            ProgressStart("Exporting...");

            int totalRows = matrix.Rows.Count;

            if (FileExistsAndNotOverwrite(options.Filename))
            {
                return;
            }
            FileInfo file = new FileInfo(options.Filename);

            using (SQLiteExporterService service = new SQLiteExporterService(file.FullName)) {
                service.CreateTable("ExportedData", matrix);

                service.BeginTransaction();
                int count = 0;
                foreach (MatrixRow row in matrix)
                {
                    service.InsertRow("ExportedData", row);
                    if (++count % 1000 == 0)
                    {
                        double percent = ((double)count / (double)totalRows) * 100.0;
                        ProgressMessage(String.Format("Exporting {0} rows of {1}...", count, totalRows), percent);
                    }
                }
                ProgressMessage(String.Format("Saving...", count, totalRows));
                service.CommitTransaction();
            }

            ProgressEnd(String.Format("{0} rows exported.", totalRows));
        }