static void Main(string[] args)
        {
            try
            {
                Book book = new BinBook();

                Font font = book.addFont();
                font.size = 36;

                Format format = book.addFormat();
                format.alignH = AlignH.ALIGNH_CENTER;
                format.setBorder(BorderStyle.BORDERSTYLE_MEDIUMDASHDOTDOT);
                format.setBorderColor(Color.COLOR_RED);
                format.font = font;

                Sheet sheet = book.addSheet("Sheet1");
                sheet.writeStr(2, 1, "Format", format);
                sheet.setCol(1, 1, 25);

                book.save("format.xls");

                System.Diagnostics.Process.Start("format.xls");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                Book book = new BinBook();

                int f1 = book.addCustomNumFormat("0.0");
                int f2 = book.addCustomNumFormat("0.00");
                int f3 = book.addCustomNumFormat("0.000");
                int f4 = book.addCustomNumFormat("0.0000");
                int f5 = book.addCustomNumFormat("#,###.00 $");
                int f6 = book.addCustomNumFormat("#,###.00 $[Black][<1000];#,###.00 $[Red][>=1000]");

                Format format1 = book.addFormat();
                format1.setNumFormat(f1);

                Format format2 = book.addFormat();
                format2.setNumFormat(f2);

                Format format3 = book.addFormat();
                format3.setNumFormat(f3);

                Format format4 = book.addFormat();
                format4.setNumFormat(f4);

                Format format5 = book.addFormat();
                format5.setNumFormat(f5);

                Format format6 = book.addFormat();
                format6.setNumFormat(f6);

                Sheet sheet = book.addSheet("Custom formats");
                sheet.setCol(0, 20);

                sheet.writeNum(2, 0, 25.718, format1);
                sheet.writeNum(3, 0, 25.718, format2);
                sheet.writeNum(4, 0, 25.718, format3);
                sheet.writeNum(5, 0, 25.718, format4);

                sheet.writeNum(7, 0, 1800.5, format5);

                sheet.writeNum(9, 0, 500, format6);
                sheet.writeNum(10, 0, 1600, format6);

                book.save("custom.xls");

                System.Diagnostics.Process.Start("custom.xls");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            try
            {
                Book book = new BinBook();
                book.load("example.xls");
                Sheet  sheet = book.getSheet(0);
                double d     = sheet.readNum(3, 1);
                sheet.writeNum(3, 1, d * 2);
                sheet.writeStr(4, 1, "new string");
                book.save("example.xls");

                System.Diagnostics.Process.Start("example.xls");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            try
            {
                Book book = new BinBook();
                book.load("example.xls");
                Sheet sheet = book.getSheet(0);

                string s = sheet.readStr(2, 1);
                Console.WriteLine(s);

                double d = sheet.readNum(3, 1);
                Console.WriteLine(d);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.Write("\nPress any key to exit...");
            Console.ReadKey();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            try
            {
                Book  book  = new BinBook();
                Sheet sheet = book.addSheet("Sheet1");

                sheet.writeStr(2, 1, "Hello, World !");
                sheet.writeNum(3, 1, 1000);

                Format dateFormat = book.addFormat();
                dateFormat.setNumFormat(NumFormat.NUMFORMAT_DATE);
                sheet.writeNum(4, 1, book.datePack(2008, 4, 29), dateFormat);
                sheet.setCol(1, 1, 12);

                book.save("example.xls");

                System.Diagnostics.Process.Start("example.xls");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #6
0
        static void test(int number)
        {
            Console.WriteLine("---------------------------------");
            if (number == 1)
            {
                Console.WriteLine("           strings               ");
            }
            else
            {
                Console.WriteLine("           numbers               ");
            }
            Console.WriteLine("---------------------------------\n");

            Book  book  = new BinBook();
            Sheet sheet = book.addSheet("Sheet1");

            Console.Write("writing {0:#,###} cells... ", (maxRow - 1) * maxCol);
            DateTime t1 = DateTime.Now;

            if (number == 1)
            {
                for (int row = 1; row < maxRow; ++row)
                {
                    for (int col = 0; col < maxCol; ++col)
                    {
                        sheet.writeStr(row, col, makeString());
                    }
                }
            }
            else
            {
                for (int row = 1; row < maxRow; ++row)
                {
                    for (int col = 0; col < maxCol; ++col)
                    {
                        sheet.writeNum(row, col, 1234);
                    }
                }
            }

            Console.WriteLine("ok");

            DateTime t2 = DateTime.Now;
            TimeSpan d  = t2 - t1;

            Console.WriteLine("time: {0} sec", d.TotalSeconds);

            double n = (maxRow - 1) * maxCol / d.TotalSeconds;

            Console.WriteLine("speed: {0:#,###} cells/sec", n);
            Console.WriteLine();

            Console.Write("saving... ");

            if (number == 1)
            {
                book.save("perfstr.xls");
            }
            else
            {
                book.save("perfnum.xls");
            }

            Console.WriteLine("ok");

            DateTime t3 = DateTime.Now;

            Console.WriteLine("time: {0} sec", (t3 - t2).TotalSeconds);
            Console.WriteLine();

            Console.WriteLine("total time: {0} sec", (t3 - t1).TotalSeconds);

            d = t3 - t1;
            n = (maxRow - 1) * maxCol / d.TotalSeconds;
            Console.WriteLine("speed with saving on disk: {0:#,###} cells/sec\n", n);

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
        }
Exemple #7
0
        static void Main(string[] args)
        {
            try
            {
                Book book = new BinBook();

                Font boldFont = book.addFont();
                boldFont.bold = true;

                Font titleFont = book.addFont();
                titleFont.name = "Arial Black";
                titleFont.size = 16;

                Format titleFormat = book.addFormat();
                titleFormat.font = titleFont;

                Format headerFormat = book.addFormat();
                headerFormat.alignH = AlignH.ALIGNH_CENTER;
                headerFormat.setBorder(BorderStyle.BORDERSTYLE_THIN);
                headerFormat.font                   = boldFont;
                headerFormat.fillPattern            = FillPattern.FILLPATTERN_SOLID;
                headerFormat.patternForegroundColor = Color.COLOR_TAN;

                Format descriptionFormat = book.addFormat();
                descriptionFormat.borderLeft = BorderStyle.BORDERSTYLE_THIN;

                Format amountFormat = book.addFormat();
                amountFormat.setNumFormat(NumFormat.NUMFORMAT_CURRENCY_NEGBRA);
                amountFormat.borderLeft  = BorderStyle.BORDERSTYLE_THIN;
                amountFormat.borderRight = BorderStyle.BORDERSTYLE_THIN;

                Format totalLabelFormat = book.addFormat();
                totalLabelFormat.borderTop = BorderStyle.BORDERSTYLE_THIN;
                totalLabelFormat.alignH    = AlignH.ALIGNH_RIGHT;
                totalLabelFormat.font      = boldFont;

                Format totalFormat = book.addFormat();
                totalFormat.setNumFormat(NumFormat.NUMFORMAT_CURRENCY_NEGBRA);
                totalFormat.setBorder(BorderStyle.BORDERSTYLE_THIN);
                totalFormat.font                   = boldFont;
                totalFormat.fillPattern            = FillPattern.FILLPATTERN_SOLID;
                totalFormat.patternForegroundColor = Color.COLOR_YELLOW;

                Format signatureFormat = book.addFormat();
                signatureFormat.alignH    = AlignH.ALIGNH_CENTER;
                signatureFormat.borderTop = BorderStyle.BORDERSTYLE_THIN;

                Sheet sheet = book.addSheet("Invoice");

                sheet.writeStr(2, 1, "Invoice No. 3568", titleFormat);

                sheet.writeStr(4, 1, "Name: John Smith");
                sheet.writeStr(5, 1, "Address: San Ramon, CA 94583 USA");

                sheet.writeStr(7, 1, "Description", headerFormat);
                sheet.writeStr(7, 2, "Amount", headerFormat);

                sheet.writeStr(8, 1, "Ball-Point Pens", descriptionFormat);
                sheet.writeNum(8, 2, 85, amountFormat);
                sheet.writeStr(9, 1, "T-Shirts", descriptionFormat);
                sheet.writeNum(9, 2, 150, amountFormat);
                sheet.writeStr(10, 1, "Tea cups", descriptionFormat);
                sheet.writeNum(10, 2, 45, amountFormat);

                sheet.writeStr(11, 1, "Total:", totalLabelFormat);
                sheet.writeNum(11, 2, 280, totalFormat);

                sheet.writeStr(14, 2, "Signature", signatureFormat);

                sheet.setCol(1, 1, 40);
                sheet.setCol(2, 2, 15);

                book.save("invoice.xls");

                System.Diagnostics.Process.Start("invoice.xls");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public static bool ExportToExcel(Application rvtApp, Document doc, bool includeFireRating, bool includeComments)
        {
            Console.WriteLine("start create Excel.");
            Book book = new BinBook(); // use XmlBook() for xlsx

            if (null == book)
            {
                throw new InvalidOperationException("Could not create BinBook.");
            }

            if (includeFireRating)
            {
                Sheet sheet = book.addSheet("Door Type FireRating");
                sheet.writeStr(1, 1, "Element ID");
                sheet.writeStr(1, 2, "Unique ID");
                sheet.writeStr(1, 3, "Family Name");
                sheet.writeStr(1, 4, "Family Type");
                sheet.writeStr(1, 5, FireRating);

                List <Element> elems = GetTargetElements(doc, BuiltInCategory.OST_Doors, false);
                // Loop through all elements and export each to an Excel row

                int row = 2;
                foreach (Element e in elems)
                {
                    sheet.writeNum(row, 1, e.Id.IntegerValue);
                    sheet.writeStr(row, 2, e.UniqueId);

                    FamilySymbol symbol = e as FamilySymbol;
                    if (null != symbol)
                    {
                        sheet.writeStr(row, 3, symbol.FamilyName);
                        sheet.writeStr(row, 4, symbol.Name);

                        // FireRating:
                        Parameter fireRatingParam = symbol.get_Parameter(BuiltInParameter.DOOR_FIRE_RATING);
                        if (fireRatingParam != null)
                        {
                            sheet.writeStr(row, 5, fireRatingParam.AsString());
                            Console.WriteLine("write row " + row.ToString() + ":" + e.Id.IntegerValue.ToString() + "," + e.UniqueId + "," + symbol.FamilyName + "," + symbol.Name + "," + fireRatingParam.AsString());
                        }
                    }
                    ++row;
                }
            }

            if (includeComments)
            {
                Sheet sheet = book.addSheet("Door Instance Comments");
                sheet.writeStr(1, 1, "Element ID");
                sheet.writeStr(1, 2, "Unique ID");
                sheet.writeStr(1, 3, "Instance Name");
                sheet.writeStr(1, 4, Comments);

                Console.WriteLine("write comments");

                List <Element> elems = GetTargetElements(doc, BuiltInCategory.OST_Doors, true);
                // Loop through all elements and export each to an Excel row
                int row = 2;
                foreach (Element e in elems)
                {
                    sheet.writeNum(row, 1, e.Id.IntegerValue);
                    sheet.writeStr(row, 2, e.UniqueId);
                    sheet.writeStr(row, 3, e.Name);

                    // Comments:
                    Parameter commentsParam = e.get_Parameter(
                        BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);
                    if (null != commentsParam)
                    {
                        sheet.writeStr(row, 4, commentsParam.AsString());
                        Console.WriteLine("write row " + row.ToString() + ":" + e.Id.IntegerValue.ToString() + "," + e.UniqueId + "," + e.Name + "," + commentsParam.AsString());
                    }
                    ++row;
                }
            }
            book.save("result.xls");
            Console.WriteLine("Excel App is created");
            return(true);
        }
        public static bool ImportFromExcel(Application rvtApp, Document doc, bool includeFireRating, bool includeComments)
        {
            Book book = new BinBook();

            book.load("input.xls");

            if (includeFireRating)
            {
                // 1st sheet is FireRating
                Sheet worksheet = book.getSheet(0);
                if (worksheet == null)
                {
                    throw new FileLoadException("Could not get worksheet.");
                }
                using (Transaction t = new Transaction(doc))
                {
                    t.Start("Import FireRating parameters from Excel");
                    // Starting from row 2, loop the rows and extract params.
                    int    id;
                    string fireRatingValue;
                    int    row = 2;

                    int count = worksheet.lastRow();
                    Console.WriteLine("Total Row is: " + count);
                    while (row < count)
                    {
                        try
                        {
                            // Extract relevant XLS values.
                            Console.WriteLine("Read the Row: " + row.ToString());

                            id = (int)worksheet.readNum(row, 1);
                            if (0 >= id)
                            {
                                continue;
                            }
                            Console.WriteLine("Read the elemnt Id: " + id.ToString());

                            // Read FireRating value
                            fireRatingValue = worksheet.readStr(row, 5);
                            Console.WriteLine("Read the fire rating value: " + fireRatingValue);

                            // Get document's door element via Id
                            ElementId elementId = new ElementId(id);
                            Element   doorType  = doc.GetElement(elementId);

                            // Set the param
                            if (null != doorType)
                            {
                                Console.WriteLine("Read the fire rating value of the door: " + doorType.Id.ToString());
                                Parameter fireRatingParam = doorType.get_Parameter(BuiltInParameter.DOOR_FIRE_RATING);
                                if (null != fireRatingParam)
                                {
                                    if (!fireRatingParam.IsReadOnly)
                                    {
                                        fireRatingParam.Set(fireRatingValue);
                                        Console.WriteLine("write row: " + row.ToString() + " id: " + doorType.Id.IntegerValue.ToString() + " value: " + fireRatingParam.AsString());
                                    }
                                }
                            }
                            Console.WriteLine("Set the parameters of " + elementId.ToString());
                        }
                        catch (System.Exception e)
                        {
                            Console.WriteLine("Get the exception of " + e.Message);
                            break;
                        }
                        ++row;
                    }
                    t.Commit();
                    Console.WriteLine("Commit the FireRating opearation.");
                }
            }
            if (includeComments)
            {
                // 2nd sheet is Comments
                Sheet worksheet = book.getSheet(1);
                if (worksheet == null)
                {
                    throw new FileLoadException("Could not get worksheet.");
                }
                using (Transaction t = new Transaction(doc))
                {
                    t.Start("Import Comments Values from Excel");
                    // Starting from row 2, loop the rows and extract Id and FireRating param.
                    int    id;
                    string comments;
                    int    row = 2;

                    int count = worksheet.lastRow();
                    Console.WriteLine("Total Row is: " + count);
                    while (row < count)
                    {
                        try
                        {
                            // Extract relevant XLS values.
                            Console.WriteLine("Read the Row: " + row.ToString());
                            id = (int)worksheet.readNum(row, 1);
                            if (0 >= id)
                            {
                                continue;
                            }
                            Console.WriteLine("Read the elemnt Id: " + id.ToString());

                            // Read Door instance comments value
                            comments = worksheet.readStr(row, 4);
                            Console.WriteLine("Read the comments value: " + comments);

                            ElementId elementId = new ElementId(id);
                            Element   door      = doc.GetElement(elementId);

                            // Set the param
                            if (null != door)
                            {
                                Console.WriteLine("Read the comments value of the door: " + door.Id.ToString());
                                Parameter commentsParam = door.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);
                                if (null != commentsParam)
                                {
                                    if (!commentsParam.IsReadOnly)
                                    {
                                        commentsParam.Set(comments);
                                        Console.WriteLine("write row: " + row.ToString() + " id: " + door.Id.IntegerValue.ToString() + " value: " + commentsParam.AsString());
                                    }
                                }
                            }
                            Console.WriteLine("Set the parameters of " + elementId.ToString());
                        }
                        catch (System.Exception e)
                        {
                            Console.WriteLine("Get the exception of " + e.Message);
                            break;
                        }
                        ++row;
                    }
                    t.Commit();
                    Console.WriteLine("Commit the Comments opearation.");
                }
            }

            ModelPath path = ModelPathUtils.ConvertUserVisiblePathToModelPath("result.rvt");

            doc.SaveAs(path, new SaveAsOptions());
            Console.WriteLine("Revit File is saved at " + path.CentralServerPath);
            return(true);
        }
Exemple #10
0
        static void Main(string[] args)
        {
            try
            {
                // Read config
                List <string> configStrLst = new List <string>(new string[] { "element1", "element2", "element3" });

                try
                {
                    System.IO.StreamReader file = new System.IO.StreamReader(Constants.TEST_CONFIG_DIR);
                    string line;
                    int    cnt = 0;
                    while ((line = file.ReadLine()) != null)
                    {
                        //System.Console.WriteLine(line);
                        configStrLst[cnt] = line;
                        cnt++;
                    }
                }
                catch (System.Exception e)
                {
                    Console.WriteLine(e);
                    Console.WriteLine("TEST CONFIG NOT FOUND");
                    Console.WriteLine(Constants.TEST_CONFIG_DIR);
                    return;
                }

                int caseStart = 1;
                int caseEnd   = 3;
                caseStart = Int16.Parse(configStrLst[1]);
                caseEnd   = Int16.Parse(configStrLst[2]);
                string tstPlanDir = Constants.TESTPLAN_DIR + configStrLst[0];

                Book              book   = new BinBook();
                PeopleDetector    peoDtc = new PeopleDetector();
                ExcuteTest        exTst  = new ExcuteTest();
                GetGroundCloudTst gndTst = new GetGroundCloudTst(caseStart);
                GetPeopleDataTst  peoTst = new GetPeopleDataTst(caseStart);

                if (book.load(tstPlanDir))
                {
                    Console.WriteLine("Testplan file name: " + configStrLst[0]);
                    Console.WriteLine("Start from case number: " + configStrLst[1]);
                    Console.WriteLine("End at case number: " + configStrLst[2]);
                    Sheet sheet = book.getSheet(0);

                    /* Parse the sequences */
                    int    tstCaseCnt  = 0;
                    int    sequenceIdx = 10;
                    double sequenceNum = sheet.readNum(sequenceIdx, 4);
                    while (true)
                    {
                        switch (sequenceNum)
                        {
                        case 1:     // Run function 1
                            if (tstCaseCnt >= caseStart)
                            {
                                exTst.Run(peoDtc, sheet, sequenceIdx);
                                book.save(Constants.TEST_RESULT_DIR);
                            }
                            break;

                        case 2:     // Run function 2
                            if (tstCaseCnt >= caseStart)
                            {
                                gndTst.Run(peoDtc, sheet, sequenceIdx);
                                book.save(Constants.TEST_RESULT_DIR);
                            }
                            break;

                        case 3:     // Run function 3
                            if (tstCaseCnt >= caseStart)
                            {
                                peoTst.Run(peoDtc, sheet, sequenceIdx);
                                book.save(Constants.TEST_RESULT_DIR);
                            }
                            break;

                        case -1:     // Start testcase
                            tstCaseCnt = tstCaseCnt + 1;
                            if (tstCaseCnt > caseEnd)
                            {
                                goto ENDTEST;
                            }
                            else if (tstCaseCnt >= caseStart)
                            {
                                System.Console.WriteLine("Start testcase number " + tstCaseCnt);
                            }
                            break;

                        case -2:     // End testcase
                            if (tstCaseCnt >= caseStart)
                            {
                                System.Console.WriteLine("End testcase number " + tstCaseCnt);
                            }
                            break;

                        case -3:     // Stop
                            goto ENDTEST;

                        default:     // Invalid
                            return;
                        }
                        //Console.WriteLine(sequenceNum);
                        sequenceIdx = sequenceIdx + 1;
                        sequenceNum = sheet.readNum(sequenceIdx, 4);
                    }
ENDTEST:
                    Console.WriteLine("END TEST");
                }
                else
                {
                    Console.WriteLine("TESTPLAN_DIR NOT FOUND");
                    Console.WriteLine(tstPlanDir);
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public MainWindowViewModel()
        {
            MoistureContent = "0";
            Data            = new ObservableCollection <Tuple <double, double> >()
            {
            };

            Series = new WpfPlot();
            Series.plt.Title("Liquid limit test", fontSize: 20);
            Series.plt.XLabel("Number of blows (N)", bold: true);
            Series.plt.YLabel("Moisture content (%)", bold: true);
            Series.plt.Ticks(logScaleY: true);
            Series.Configure(lockHorizontalAxis: true, lockVerticalAxis: true);

            Series.plt.AxisAuto(horizontalMargin: 0, verticalMargin: 0.9);

            //_dataPlot = Series.plt.PlotScatter(_data.OrderBy(d => d.Item1).Select(d => d.Item1).ToArray(), _data.OrderBy(d => d.Item1).Select(d => d.Item2).ToArray());

            ClearDataCommand = new DelegateCommand(() =>
            {
                NumberOfBlows   = 0;
                MoistureContent = "";
                Data.Clear();
                Series.plt.Clear();

                if (_dataPlot == null)
                {
                    _dataPlot = Series.plt.PlotScatter(Data.OrderBy(d => d.Item1).Select(d => d.Item1).ToArray(), Data.OrderBy(d => d.Item1).Select(d => d.Item2).ToArray());
                }
            });

            AddDataCommand = new DelegateCommand(() =>
            {
                Data.Add(new Tuple <double, double>(NumberOfBlows, Double.Parse(MoistureContent)));
                if (Data.Count() >= 2)
                {
                    Series.plt.Clear();
                    _dataPlot = Series.plt.PlotScatter(Data.OrderBy(d => d.Item1).Select(d => d.Item1).ToArray(), Data.OrderBy(d => d.Item1).Select(d => d.Item2).ToArray(), color: System.Drawing.Color.Gray, lineStyle: LineStyle.Dash);

                    DrawRegressionLine();
                }

                NumberOfBlows   = 0;
                MoistureContent = "0";
            });

            ExportCommand = new DelegateCommand(() =>
            {
                var dialog    = new SaveFileDialog();
                dialog.Filter = "Excel file (*.xls)|*.xls";
                dialog.ShowDialog();
                ;

                var fileName = dialog.FileName;

                if (String.IsNullOrEmpty(fileName))
                {
                    return;
                }

                Series.plt.SaveFig($"{fileName}.png");

                var book = new BinBook();

                var id = book.addPicture(fileName + ".png");

                var sheet = book.addSheet("Chart");
                sheet.setPicture(10, 3, id);

                book.save(fileName);
            });
        }
        public MainWindowViewModel()
        {
            Data = new ObservableCollection <Tuple <double, double> >();

            Series = new WpfPlot();
            Series.plt.Title("Potential Expansivess", bold: true, fontSize: 22);
            Series.plt.XLabel("Clay fraction of whole sample", bold: true);
            Series.plt.YLabel("PI of whole sample", bold: true);


            Series.plt.AxisBounds(0, _xMax, 0, _yMax);
            Series.Configure(lockHorizontalAxis: true, lockVerticalAxis: true);
            Series.plt.Grid(xSpacing: 10, ySpacing: 10, lineWidth: 2);
            // Series.plt.AxisZoom(0, 0, -20, -20);
            //Series.Width = 800;

            AddDataCommand = new DelegateCommand(() =>
            {
                Data.Add(new Tuple <double, double>(ClayFractionOfWholeSample, PiOfWholeSample));

                Series.plt.PlotPoint(ClayFractionOfWholeSample, PiOfWholeSample, GetColor(), 15);
                Series.plt.PlotText(_pointLabel, ClayFractionOfWholeSample - 0.5, PiOfWholeSample + 1, System.Drawing.Color.Black);

                Series.Render();
            });

            ClearDataCommand = new DelegateCommand(() =>
            {
                ClayFractionOfWholeSample = 0;
                PiOfWholeSample           = 0;

                Data.Clear();
                Series.plt.Clear();
                DrawAbaque();
                Series.plt.AxisBounds(0, _xMax, 0, _yMax);
                Series.Render();
            });

            ExportCommand = new DelegateCommand(() =>
            {
                var dialog    = new SaveFileDialog();
                dialog.Filter = "Excel file (*.xls)|*.xls";
                dialog.ShowDialog();
                ;

                var fileName = dialog.FileName;

                if (String.IsNullOrEmpty(fileName))
                {
                    return;
                }

                Series.plt.SaveFig($"{fileName}.png");

                var book = new BinBook();

                var id = book.addPicture(fileName + ".png");

                var sheet = book.addSheet("Chart");
                sheet.setPicture(10, 3, id);

                book.save(fileName);
            });

            DrawAbaque();
        }