예제 #1
0
        FromString
        (
            String theString
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(theString));

            AutoFillWorkbookResults oAutoFillWorkbookResults =
                new AutoFillWorkbookResults();

            oAutoFillWorkbookResults.ConvertFromString(theString);

            return(oAutoFillWorkbookResults);
        }
예제 #2
0
        AutoFillVertexTable
        (
            ListObject oVertexTable,
            AutoFillUserSettings oAutoFillUserSettings,
            AutoFillWorkbookResults oAutoFillWorkbookResults
        )
        {
            Debug.Assert(oVertexTable != null);
            Debug.Assert(oAutoFillUserSettings != null);
            Debug.Assert(oAutoFillWorkbookResults != null);

            Double dSourceCalculationNumber1, dSourceCalculationNumber2;
            Int32  iDecimalPlaces;

            if (TryAutoFillColorColumn(oVertexTable,
                                       oAutoFillUserSettings.VertexColorSourceColumnName,
                                       VertexTableColumnNames.Color,
                                       oAutoFillUserSettings.VertexColorDetails,
                                       out dSourceCalculationNumber1,
                                       out dSourceCalculationNumber2,
                                       out iDecimalPlaces
                                       ))
            {
                oAutoFillWorkbookResults.VertexColorResults =
                    new AutoFillColorColumnResults(
                        oAutoFillUserSettings.VertexColorSourceColumnName,
                        dSourceCalculationNumber1, dSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.VertexColorDetails.DestinationColor1,
                        oAutoFillUserSettings.VertexColorDetails.DestinationColor2
                        );
            }

            AutoFillNumericComparisonColumn(oVertexTable,
                                            oAutoFillUserSettings.VertexShapeSourceColumnName,
                                            VertexTableColumnNames.Shape,
                                            oAutoFillUserSettings.VertexShapeDetails
                                            );

            if (TryAutoFillNumericRangeColumn(oVertexTable,
                                              oAutoFillUserSettings.VertexRadiusSourceColumnName,
                                              VertexTableColumnNames.Radius,
                                              oAutoFillUserSettings.VertexRadiusDetails,
                                              out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                              out iDecimalPlaces
                                              ))
            {
                oAutoFillWorkbookResults.VertexRadiusResults =
                    new AutoFillNumericRangeColumnResults(
                        oAutoFillUserSettings.VertexRadiusSourceColumnName,
                        dSourceCalculationNumber1, dSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.VertexRadiusDetails.
                        DestinationNumber1,
                        oAutoFillUserSettings.VertexRadiusDetails.
                        DestinationNumber2
                        );
            }

            if (TryAutoFillNumericRangeColumn(oVertexTable,
                                              oAutoFillUserSettings.VertexAlphaSourceColumnName,
                                              CommonTableColumnNames.Alpha,
                                              oAutoFillUserSettings.VertexAlphaDetails,
                                              out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                              out iDecimalPlaces
                                              ))
            {
                oAutoFillWorkbookResults.VertexAlphaResults =
                    new AutoFillNumericRangeColumnResults(
                        oAutoFillUserSettings.VertexAlphaSourceColumnName,
                        dSourceCalculationNumber1, dSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.VertexAlphaDetails.DestinationNumber1,
                        oAutoFillUserSettings.VertexAlphaDetails.DestinationNumber2
                        );
            }

            AutoFillColumnViaCopy(oVertexTable,
                                  oAutoFillUserSettings.VertexLabelSourceColumnName,
                                  VertexTableColumnNames.Label
                                  );

            TryAutoFillColorColumn(oVertexTable,
                                   oAutoFillUserSettings.VertexLabelFillColorSourceColumnName,
                                   VertexTableColumnNames.LabelFillColor,
                                   oAutoFillUserSettings.VertexLabelFillColorDetails,
                                   out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                   out iDecimalPlaces
                                   );

            AutoFillColumnViaCopy(oVertexTable,
                                  oAutoFillUserSettings.VertexToolTipSourceColumnName,
                                  VertexTableColumnNames.ToolTip
                                  );

            AutoFillNumericComparisonColumn(oVertexTable,
                                            oAutoFillUserSettings.VertexVisibilitySourceColumnName,
                                            CommonTableColumnNames.Visibility,
                                            oAutoFillUserSettings.VertexVisibilityDetails
                                            );

            TryAutoFillNumericRangeColumn(oVertexTable,
                                          oAutoFillUserSettings.VertexLayoutOrderSourceColumnName,
                                          VertexTableColumnNames.LayoutOrder,
                                          oAutoFillUserSettings.VertexLayoutOrderDetails,
                                          out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                          out iDecimalPlaces
                                          );

            Boolean bXAutoFilled = TryAutoFillNumericRangeColumn(oVertexTable,
                                                                 oAutoFillUserSettings.VertexXSourceColumnName,
                                                                 VertexTableColumnNames.X,
                                                                 oAutoFillUserSettings.VertexXDetails,
                                                                 out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                                                 out iDecimalPlaces
                                                                 );

            Double dYSourceCalculationNumber1, dYSourceCalculationNumber2;

            Boolean bYAutoFilled = TryAutoFillNumericRangeColumn(oVertexTable,
                                                                 oAutoFillUserSettings.VertexYSourceColumnName,
                                                                 VertexTableColumnNames.Y,
                                                                 oAutoFillUserSettings.VertexYDetails,
                                                                 out dYSourceCalculationNumber1, out dYSourceCalculationNumber2,
                                                                 out iDecimalPlaces
                                                                 );

            if (bXAutoFilled && bYAutoFilled)
            {
                // (Note that the decimal places for the Y column take precedence
                // here.)

                oAutoFillWorkbookResults.VertexXResults =
                    new AutoFillNumericRangeColumnResults(
                        oAutoFillUserSettings.VertexXSourceColumnName,
                        dSourceCalculationNumber1, dSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.VertexXDetails.DestinationNumber1,
                        oAutoFillUserSettings.VertexXDetails.DestinationNumber2
                        );

                oAutoFillWorkbookResults.VertexYResults =
                    new AutoFillNumericRangeColumnResults(
                        oAutoFillUserSettings.VertexYSourceColumnName,
                        dYSourceCalculationNumber1, dYSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.VertexYDetails.DestinationNumber1,
                        oAutoFillUserSettings.VertexYDetails.DestinationNumber2
                        );
            }

            TryAutoFillNumericRangeColumn(oVertexTable,
                                          oAutoFillUserSettings.VertexPolarRSourceColumnName,
                                          VertexTableColumnNames.PolarR,
                                          oAutoFillUserSettings.VertexPolarRDetails,
                                          out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                          out iDecimalPlaces
                                          );

            TryAutoFillNumericRangeColumn(oVertexTable,
                                          oAutoFillUserSettings.VertexPolarAngleSourceColumnName,
                                          VertexTableColumnNames.PolarAngle,
                                          oAutoFillUserSettings.VertexPolarAngleDetails,
                                          out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                          out iDecimalPlaces
                                          );
        }
예제 #3
0
        AutoFillEdgeTable
        (
            ListObject oEdgeTable,
            AutoFillUserSettings oAutoFillUserSettings,
            AutoFillWorkbookResults oAutoFillWorkbookResults
        )
        {
            Debug.Assert(oEdgeTable != null);
            Debug.Assert(oAutoFillUserSettings != null);
            Debug.Assert(oAutoFillWorkbookResults != null);

            Double dSourceCalculationNumber1, dSourceCalculationNumber2;
            Int32  iDecimalPlaces;

            if (TryAutoFillColorColumn(oEdgeTable,
                                       oAutoFillUserSettings.EdgeColorSourceColumnName,
                                       EdgeTableColumnNames.Color,
                                       oAutoFillUserSettings.EdgeColorDetails,
                                       out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                       out iDecimalPlaces
                                       ))
            {
                oAutoFillWorkbookResults.EdgeColorResults =
                    new AutoFillColorColumnResults(
                        oAutoFillUserSettings.EdgeColorSourceColumnName,
                        dSourceCalculationNumber1, dSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.EdgeColorDetails.DestinationColor1,
                        oAutoFillUserSettings.EdgeColorDetails.DestinationColor2
                        );
            }

            if (TryAutoFillNumericRangeColumn(oEdgeTable,
                                              oAutoFillUserSettings.EdgeWidthSourceColumnName,
                                              EdgeTableColumnNames.Width,
                                              oAutoFillUserSettings.EdgeWidthDetails,
                                              out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                              out iDecimalPlaces
                                              ))
            {
                oAutoFillWorkbookResults.EdgeWidthResults =
                    new AutoFillNumericRangeColumnResults(
                        oAutoFillUserSettings.EdgeWidthSourceColumnName,
                        dSourceCalculationNumber1, dSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.EdgeWidthDetails.DestinationNumber1,
                        oAutoFillUserSettings.EdgeWidthDetails.DestinationNumber2
                        );
            }

            if (TryAutoFillNumericRangeColumn(oEdgeTable,
                                              oAutoFillUserSettings.EdgeAlphaSourceColumnName,
                                              CommonTableColumnNames.Alpha,
                                              oAutoFillUserSettings.EdgeAlphaDetails,
                                              out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                              out iDecimalPlaces
                                              ))
            {
                oAutoFillWorkbookResults.EdgeAlphaResults =
                    new AutoFillNumericRangeColumnResults(
                        oAutoFillUserSettings.EdgeAlphaSourceColumnName,
                        dSourceCalculationNumber1, dSourceCalculationNumber2,
                        iDecimalPlaces,
                        oAutoFillUserSettings.EdgeAlphaDetails.DestinationNumber1,
                        oAutoFillUserSettings.EdgeAlphaDetails.DestinationNumber2
                        );
            }

            AutoFillNumericComparisonColumn(oEdgeTable,
                                            oAutoFillUserSettings.EdgeVisibilitySourceColumnName,
                                            CommonTableColumnNames.Visibility,
                                            oAutoFillUserSettings.EdgeVisibilityDetails
                                            );

            AutoFillColumnViaCopy(oEdgeTable,
                                  oAutoFillUserSettings.EdgeLabelSourceColumnName,
                                  EdgeTableColumnNames.Label
                                  );
        }
예제 #4
0
        AutoFillWorkbookInternal
        (
            Microsoft.Office.Interop.Excel.Workbook oWorkbook,
            AutoFillUserSettings oAutoFillUserSettings
        )
        {
            Debug.Assert(oWorkbook != null);
            Debug.Assert(oAutoFillUserSettings != null);

            // Populate the vertex worksheet with the name of each unique vertex in
            // the edge worksheet.

            (new VertexWorksheetPopulator()).PopulateVertexWorksheet(
                oWorkbook, false);

            ListObject         oTable;
            ExcelHiddenColumns oHiddenColumns;

            AutoFillWorkbookResults oAutoFillWorkbookResults =
                new AutoFillWorkbookResults();

            if (ExcelUtil.TryGetTable(oWorkbook, WorksheetNames.Edges,
                                      TableNames.Edges, out oTable))
            {
                // The TableColumnMapper class that does the actual autofilling
                // fills only visible cells.  Temporarily show all hidden columns
                // in the table.

                oHiddenColumns = ExcelColumnHider.ShowHiddenColumns(oTable);

                try
                {
                    AutoFillEdgeTable(oTable, oAutoFillUserSettings,
                                      oAutoFillWorkbookResults);
                }
                finally
                {
                    ExcelColumnHider.RestoreHiddenColumns(oTable, oHiddenColumns);
                }
            }

            if (ExcelUtil.TryGetTable(oWorkbook, WorksheetNames.Vertices,
                                      TableNames.Vertices, out oTable))
            {
                oHiddenColumns = ExcelColumnHider.ShowHiddenColumns(oTable);

                try
                {
                    AutoFillVertexTable(oTable, oAutoFillUserSettings,
                                        oAutoFillWorkbookResults);
                }
                finally
                {
                    ExcelColumnHider.RestoreHiddenColumns(oTable, oHiddenColumns);
                }
            }

            // Save the results.

            (new PerWorkbookSettings(oWorkbook)).AutoFillWorkbookResults =
                oAutoFillWorkbookResults;
        }