コード例 #1
0
        //*************************************************************************
        //  Method: AutoFillByVertexCategory()
        //
        /// <summary>
        /// Assigns attributes based on a vertex category column.
        /// </summary>
        ///
        /// <param name="oWorkbook">
        /// The workbook to autofill.
        /// </param>
        ///
        /// <param name="oEdgeTable">
        /// The edge table.
        /// </param>
        ///
        /// <param name="oVertexTable">
        /// The vertex table.
        /// </param>
        ///
        /// <param name="sVertexCategoryColumnName">
        /// The name of the vertex table column containing vertex categories.
        /// </param>
        ///
        /// <param name="bShowVertexLabels">
        /// true if vertex labels should be shown.
        /// </param>
        ///
        /// <param name="sVertexLabelColumnName">
        /// The name of the vertex table column containing vertex labels.  Used
        /// only if <paramref name="bShowVertexLabels" /> is true.
        /// </param>
        //*************************************************************************
        private static void AutoFillByVertexCategory(
            Microsoft.Office.Interop.Excel.Workbook oWorkbook,
            Microsoft.Office.Interop.Excel.ListObject oEdgeTable,
            Microsoft.Office.Interop.Excel.ListObject oVertexTable,
            String sVertexCategoryColumnName,
            Boolean bShowVertexLabels,
            String sVertexLabelColumnName
            )
        {
            Debug.Assert(oWorkbook != null);
            Debug.Assert(oEdgeTable != null);
            Debug.Assert(oVertexTable != null);
            Debug.Assert( !String.IsNullOrEmpty(sVertexCategoryColumnName) );

            Debug.Assert( !bShowVertexLabels ||
            !String.IsNullOrEmpty(sVertexLabelColumnName) );

            Range oVisibleCategoryRange = null;
            Range oVisibleShapeRange = null;
            Range oVisibleColorRange = null;
            Range oVisibleRadiusRange = null;;

            if (
            !ExcelUtil.TryGetVisibleTableColumnData(oVertexTable,
                sVertexCategoryColumnName, out oVisibleCategoryRange)
            ||
            !ExcelUtil.TryGetVisibleTableColumnData(oVertexTable,
                VertexTableColumnNames.Shape, out oVisibleShapeRange)
            ||
            !ExcelUtil.TryGetVisibleTableColumnData(oVertexTable,
                VertexTableColumnNames.Color, out oVisibleColorRange)
            ||
            !ExcelUtil.TryGetVisibleTableColumnData(oVertexTable,
                VertexTableColumnNames.Radius, out oVisibleRadiusRange)
            )
            {
            ErrorUtil.OnMissingColumn();
            }

            // Loop through the visible areas to create a dictionary of categories.
            // The key is a unique category name and the value is a scheme index.
            // If the category column contains three unique categories, for
            // example, the dictionary entries will look like this:
            //
            // Category A, 0
            // Category B, 1
            // Category C, 2

            Dictionary<String, Int32> oCategoryDictionary =
            new Dictionary<String, Int32>();

            Areas oCategoryAreas = oVisibleCategoryRange.Areas;
            Int32 iAreas = oCategoryAreas.Count;
            Int32 iSchemeIndex = 0;

            for (Int32 iArea = 1; iArea <= iAreas; iArea++)
            {
            Object [,] aoCategoryValues = ExcelUtil.GetRangeValues(
                oCategoryAreas[iArea] );

            Int32 iRows = aoCategoryValues.GetUpperBound(0);
            String sCategory;

            for (Int32 iRow = 1; iRow <= iRows; iRow++)
            {
                if ( ExcelUtil.TryGetNonEmptyStringFromCell(aoCategoryValues,
                    iRow, 1, out sCategory) )
                {
                    if ( !oCategoryDictionary.ContainsKey(sCategory) )
                    {
                        oCategoryDictionary[sCategory] = iSchemeIndex;
                        iSchemeIndex++;
                    }
                }
            }
            }

            // Scheme index that will be used for vertices that have an empty
            // category cell.

            Int32 SchemeIndexForNoCategory = iSchemeIndex;

            Areas oShapeAreas = oVisibleShapeRange.Areas;
            Areas oColorAreas = oVisibleColorRange.Areas;
            Areas oRadiusAreas = oVisibleRadiusRange.Areas;

            Debug.Assert(oShapeAreas.Count == iAreas);
            Debug.Assert(oColorAreas.Count == iAreas);
            Debug.Assert(oRadiusAreas.Count == iAreas);

            ColorConverter2 oColorConverter2 = new ColorConverter2();

            VertexShapeConverter oVertexShapeConverter =
            new VertexShapeConverter();

            // Loop through the visible areas again, this time to fill in the
            // vertex shape, color, and radius columns.

            for (Int32 iArea = 1; iArea <= iAreas; iArea++)
            {
            Object [,] aoCategoryValues = ExcelUtil.GetRangeValues(
                oCategoryAreas[iArea] );

            Range oShapeArea = oShapeAreas[iArea];
            Range oColorArea = oColorAreas[iArea];
            Range oRadiusArea = oRadiusAreas[iArea];

            Object [,] aoShapeValues = ExcelUtil.GetRangeValues(oShapeArea);
            Object [,] aoColorValues = ExcelUtil.GetRangeValues(oColorArea);
            Object [,] aoRadiusValues = ExcelUtil.GetRangeValues(oRadiusArea);

            Int32 iRows = aoCategoryValues.GetUpperBound(0);

            Debug.Assert(aoShapeValues.GetUpperBound(0) == iRows);
            Debug.Assert(aoColorValues.GetUpperBound(0) == iRows);
            Debug.Assert(aoRadiusValues.GetUpperBound(0) == iRows);

            String sCategory;

            for (Int32 iRow = 1; iRow <= iRows; iRow++)
            {
                if ( ExcelUtil.TryGetNonEmptyStringFromCell(aoCategoryValues,
                    iRow, 1, out sCategory) )
                {
                    iSchemeIndex = oCategoryDictionary[sCategory];
                }
                else
                {
                    iSchemeIndex = SchemeIndexForNoCategory;
                }

                VertexShape eShape;
                Color oColor;
                Single fRadius;

                GetVertexCategoryScheme(iSchemeIndex, out eShape, out oColor,
                    out fRadius);

                aoShapeValues[iRow, 1] =
                    oVertexShapeConverter.GraphToWorkbook(eShape);

                // Write the color in a format that is understood by
                // ColorConverter.ConvertFromString(), which is what
                // WorksheetReaderBase uses.

                aoColorValues[iRow, 1] =
                    oColorConverter2.GraphToWorkbook(oColor);

                aoRadiusValues[iRow, 1] = fRadius;
            }

            oShapeArea.set_Value(Missing.Value, aoShapeValues);
            oColorArea.set_Value(Missing.Value, aoColorValues);
            oRadiusArea.set_Value(Missing.Value, aoRadiusValues);
            }

            // Fill in other columns with constants.

            FillColumnsWithConstants(

            oVertexTable, CommonTableColumnNames.Alpha,
                AlphaConverter.MaximumAlphaWorkbook,

            oEdgeTable, EdgeTableColumnNames.Color,
                oColorConverter2.GraphToWorkbook(
                    Color.FromArgb(179, 179, 179) ),

            oEdgeTable, EdgeTableColumnNames.Width, 1.0F,

            oEdgeTable, CommonTableColumnNames.Alpha,
                AlphaConverter.MaximumAlphaWorkbook
            );

            // Save the results.

            SaveVertexCategoryResults(oWorkbook, sVertexCategoryColumnName,
            oCategoryDictionary);
        }
コード例 #2
0
ファイル: GroupManager.cs プロジェクト: haisreekanth/NetMap
        //*************************************************************************
        //  Method: SetVertexAttributesForAllGroups()
        //
        /// <summary>
        /// Sets the vertex attributes for all the groups in the group table.
        /// </summary>
        ///
        /// <param name="oGroupTable">
        /// The group table.
        /// </param>
        //*************************************************************************
        private static void SetVertexAttributesForAllGroups(
            ListObject oGroupTable
            )
        {
            Debug.Assert(oGroupTable != null);

            Range oVertexColorRange, oVertexShapeRange;
            Object [,] aoVertexColorValues, aoVertexShapeValues;

            if (
            !ExcelUtil.TryGetTableColumnDataAndValues(oGroupTable,
                GroupTableColumnNames.VertexShape, out oVertexShapeRange,
                out aoVertexShapeValues)
            ||
            !ExcelUtil.TryGetTableColumnDataAndValues(oGroupTable,
                GroupTableColumnNames.VertexColor, out oVertexColorRange,
                out aoVertexColorValues)
            )
            {
            return;
            }

            Int32 iGroups = aoVertexShapeValues.GetUpperBound(0);
            Debug.Assert(aoVertexColorValues.GetUpperBound(0) == iGroups);

            ColorConverter2 oColorConverter2 = new ColorConverter2();

            VertexShapeConverter oVertexShapeConverter =
            new VertexShapeConverter();

            for (Int32 i = 0; i < iGroups; i++)
            {
            Color oColor;
            VertexShape eShape;

            GetVertexAttributes(i, iGroups, out oColor, out eShape);

            // Write the color in a format that is understood by
            // ColorConverter2.WorkbookToGraph(), which is what
            // WorksheetReaderBase uses.

            aoVertexColorValues[i + 1, 1] =
                oColorConverter2.GraphToWorkbook(oColor);

            aoVertexShapeValues[i + 1, 1] =
                oVertexShapeConverter.GraphToWorkbook(eShape);
            }

            oVertexColorRange.set_Value(Missing.Value, aoVertexColorValues);
            oVertexShapeRange.set_Value(Missing.Value, aoVertexShapeValues);
        }
コード例 #3
0
 SetUp()
 {
     m_oVertexShapeConverter = new VertexShapeConverter();
 }
コード例 #4
0
ファイル: Sheet2.cs プロジェクト: 2014-sed-team3/term-project
    ThisWorkbook_AttributesEditedInGraph
    (
        Object sender,
        AttributesEditedEventArgs e
    )
    {
        Debug.Assert(e != null);
        AssertValid();

        // The key is the row ID stored in the table's ID column and the value
        // is the one-based row number relative to the worksheet.

        Dictionary<Int32, Int32> oRowIDDictionary;

        if (
            e.EditedVertexAttributes == null
            ||
            !m_oSheets1And2Helper.TableExists
            ||
            !m_oSheets1And2Helper.TryGetAllRowIDs(out oRowIDDictionary)
            )
        {
            return;
        }

        Microsoft.Office.Interop.Excel.ListObject oVertexTable =
            Vertices.InnerObject;

        Globals.ThisWorkbook.ShowWaitCursor = true;

        // Get the columns that might need to be updated.  These columns are
        // not required.

        Microsoft.Office.Interop.Excel.Range oColorColumnData,
            oShapeColumnData, oRadiusColumnData, oAlphaColumnData,
            oVisibilityColumnData, oLabelColumnData, oLabelFillColorColumnData,
            oLabelPositionColumnData, oToolTipColumnData, oLockedColumnData,
            oMarkedColumnData;

        Object [,] aoColorValues = null;
        Object [,] aoShapeValues = null;
        Object [,] aoRadiusValues = null;
        Object [,] aoAlphaValues = null;
        Object [,] aoVisibilityValues = null;
        Object [,] aoLabelValues = null;
        Object [,] aoLabelFillColorValues = null;
        Object [,] aoLabelPositionValues = null;
        Object [,] aoToolTipValues = null;
        Object [,] aoLockedValues = null;
        Object [,] aoMarkedValues = null;

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Color, out oColorColumnData,
            out aoColorValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Shape, out oShapeColumnData,
            out aoShapeValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Radius, out oRadiusColumnData,
            out aoRadiusValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            CommonTableColumnNames.Alpha, out oAlphaColumnData,
            out aoAlphaValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            CommonTableColumnNames.Visibility, out oVisibilityColumnData,
            out aoVisibilityValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Label, out oLabelColumnData,
            out aoLabelValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.LabelFillColor,
            out oLabelFillColorColumnData, out aoLabelFillColorValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.LabelPosition, out oLabelPositionColumnData,
            out aoLabelPositionValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.ToolTip, out oToolTipColumnData,
            out aoToolTipValues);

        ExcelTableUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Locked, out oLockedColumnData,
            out aoLockedValues);

        if ( TryGetMarkedColumnData(out oMarkedColumnData) )
        {
            aoMarkedValues = ExcelUtil.GetRangeValues(oMarkedColumnData);
        }

        ColorConverter2 oColorConverter2 = new ColorConverter2();

        VertexShapeConverter oVertexShapeConverter =
            new VertexShapeConverter();

        VertexVisibilityConverter oVertexVisibilityConverter =
            new VertexVisibilityConverter();

        VertexLabelPositionConverter oVertexLabelPositionConverter =
            new VertexLabelPositionConverter();

        BooleanConverter oBooleanConverter = new BooleanConverter();

        // Loop through the IDs of the vertices whose attributes were edited
        // in the graph.

        EditedVertexAttributes oEditedVertexAttributes =
            e.EditedVertexAttributes;

        foreach (Int32 iID in e.VertexIDs)
        {
            // Look for the row that contains the ID.

            Int32 iRowOneBased;

            if ( !oRowIDDictionary.TryGetValue(iID, out iRowOneBased) )
            {
                continue;
            }

            iRowOneBased -= oVertexTable.Range.Row;

            if (oEditedVertexAttributes.Color.HasValue &&
                aoColorValues != null)
            {
                aoColorValues[iRowOneBased, 1] =
                    oColorConverter2.GraphToWorkbook(
                        oEditedVertexAttributes.Color.Value);
            }

            if (oEditedVertexAttributes.Shape.HasValue &&
                aoShapeValues != null)
            {
                aoShapeValues[iRowOneBased, 1] =
                    oVertexShapeConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Shape.Value);
            }

            if (oEditedVertexAttributes.Radius.HasValue &&
                aoRadiusValues != null)
            {
                aoRadiusValues[iRowOneBased, 1] =
                    oEditedVertexAttributes.Radius.Value.ToString();
            }

            if (oEditedVertexAttributes.Alpha.HasValue &&
                aoAlphaValues != null)
            {
                aoAlphaValues[iRowOneBased, 1] =
                    oEditedVertexAttributes.Alpha.Value.ToString();
            }

            if (oEditedVertexAttributes.Visibility.HasValue &&
                aoVisibilityValues != null)
            {
                aoVisibilityValues[iRowOneBased, 1] =
                    oVertexVisibilityConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Visibility.Value);
            }

            if ( !String.IsNullOrEmpty(oEditedVertexAttributes.Label) )
            {
                aoLabelValues[iRowOneBased, 1] = oEditedVertexAttributes.Label;
            }

            if (oEditedVertexAttributes.LabelFillColor.HasValue &&
                aoLabelFillColorValues != null)
            {
                aoLabelFillColorValues[iRowOneBased, 1] =
                    oColorConverter2.GraphToWorkbook(
                        oEditedVertexAttributes.LabelFillColor.Value);
            }

            if (oEditedVertexAttributes.LabelPosition.HasValue &&
                aoLabelPositionValues != null)
            {
                aoLabelPositionValues[iRowOneBased, 1] =
                    oVertexLabelPositionConverter.GraphToWorkbook(
                        oEditedVertexAttributes.LabelPosition.Value);
            }

            if ( !String.IsNullOrEmpty(oEditedVertexAttributes.ToolTip) )
            {
                aoToolTipValues[iRowOneBased, 1] =
                    oEditedVertexAttributes.ToolTip;
            }

            if (oEditedVertexAttributes.Locked.HasValue &&
                aoLockedValues != null)
            {
                aoLockedValues[iRowOneBased, 1] =
                    oBooleanConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Locked.Value);
            }

            if (oEditedVertexAttributes.Marked.HasValue &&
                aoMarkedValues != null)
            {
                aoMarkedValues[iRowOneBased, 1] =
                    oBooleanConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Marked.Value);
            }
        }

        // Activate this worksheet first, because writing to an inactive
        // worksheet causes problems with the selection in Excel.

        ExcelActiveWorksheetRestorer oExcelActiveWorksheetRestorer =
            m_oSheets1And2Helper.GetExcelActiveWorksheetRestorer();

        ExcelActiveWorksheetState oExcelActiveWorksheetState =
            oExcelActiveWorksheetRestorer.ActivateWorksheet(this.InnerObject);

        try
        {
            m_oSheets1And2Helper.SetColumnDataValues(
                oColorColumnData, aoColorValues,
                oShapeColumnData, aoShapeValues,
                oRadiusColumnData, aoRadiusValues,
                oAlphaColumnData, aoAlphaValues,
                oVisibilityColumnData, aoVisibilityValues,
                oLabelColumnData, aoLabelValues,
                oLabelFillColorColumnData, aoLabelFillColorValues,
                oLabelPositionColumnData, aoLabelPositionValues,
                oToolTipColumnData, aoToolTipValues,
                oLockedColumnData, aoLockedValues,
                oMarkedColumnData, aoMarkedValues
                );
        }
        finally
        {
            oExcelActiveWorksheetRestorer.Restore(oExcelActiveWorksheetState);
        }

        Globals.ThisWorkbook.ShowWaitCursor = false;
    }
コード例 #5
0
ファイル: Sheet2.cs プロジェクト: haisreekanth/NetMap
        //*************************************************************************
        //  Method: OnVertexAttributesEditedInGraph()
        //
        /// <summary>
        /// Handles the VertexAttributesEditedInGraph event on ThisWorkbook.
        /// </summary>
        ///
        /// <param name="e">
        /// Standard event argument.
        /// </param>
        //*************************************************************************
        private void OnVertexAttributesEditedInGraph(
            VertexAttributesEditedEventArgs e
            )
        {
            Debug.Assert(e != null);
            AssertValid();

            Microsoft.Office.Interop.Excel.ListObject oVertexTable =
            Vertices.InnerObject;

            // Get a dictionary containing the ID of each row in the table.

            Dictionary<Int32, Int32> oRowIDDictionary;

            if ( !m_oSheets1And2Helper.TryGetAllRowIDs(out oRowIDDictionary) )
            {
            // Nothing can be done without the IDs.

            return;
            }

            Globals.ThisWorkbook.ShowWaitCursor = true;

            // Get the columns that might need to be updated.  These columns are
            // not required.

            Microsoft.Office.Interop.Excel.Range oColorColumnData,
            oShapeColumnData, oRadiusColumnData, oAlphaColumnData,
            oVisibilityColumnData, oLabelPositionColumnData, oLockedColumnData,
            oMarkedColumnData;

            Object [,] aoColorValues = null;
            Object [,] aoShapeValues = null;
            Object [,] aoRadiusValues = null;
            Object [,] aoAlphaValues = null;
            Object [,] aoVisibilityValues = null;
            Object [,] aoLabelPositionValues = null;
            Object [,] aoLockedValues = null;
            Object [,] aoMarkedValues = null;

            ExcelUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Color, out oColorColumnData,
            out aoColorValues);

            ExcelUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Shape, out oShapeColumnData,
            out aoShapeValues);

            ExcelUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Radius, out oRadiusColumnData,
            out aoRadiusValues);

            ExcelUtil.TryGetTableColumnDataAndValues(oVertexTable,
            CommonTableColumnNames.Alpha, out oAlphaColumnData,
            out aoAlphaValues);

            ExcelUtil.TryGetTableColumnDataAndValues(oVertexTable,
            CommonTableColumnNames.Visibility, out oVisibilityColumnData,
            out aoVisibilityValues);

            ExcelUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.LabelPosition, out oLabelPositionColumnData,
            out aoLabelPositionValues);

            ExcelUtil.TryGetTableColumnDataAndValues(oVertexTable,
            VertexTableColumnNames.Locked, out oLockedColumnData,
            out aoLockedValues);

            if ( TryGetMarkedColumnData(out oMarkedColumnData) )
            {
            aoMarkedValues = ExcelUtil.GetRangeValues(oMarkedColumnData);
            }

            ColorConverter2 oColorConverter2 = new ColorConverter2();

            VertexShapeConverter oVertexShapeConverter =
            new VertexShapeConverter();

            VertexVisibilityConverter oVertexVisibilityConverter =
            new VertexVisibilityConverter();

            VertexLabelPositionConverter oVertexLabelPositionConverter =
            new VertexLabelPositionConverter();

            BooleanConverter oBooleanConverter = new BooleanConverter();

            // Loop through the IDs of the vertices whose attributes were edited
            // in the graph.

            EditedVertexAttributes oEditedVertexAttributes =
            e.EditedVertexAttributes;

            foreach (Int32 iID in e.VertexIDs)
            {
            // Look for the row that contains the ID.

            Int32 iRowOneBased;

            if ( !oRowIDDictionary.TryGetValue(iID, out iRowOneBased) )
            {
                continue;
            }

            iRowOneBased -= oVertexTable.Range.Row;

            if (oEditedVertexAttributes.Color.HasValue &&
                aoColorValues != null)
            {
                aoColorValues[iRowOneBased, 1] =
                    oColorConverter2.GraphToWorkbook(
                        oEditedVertexAttributes.Color.Value);
            }

            if (oEditedVertexAttributes.Shape.HasValue &&
                aoShapeValues != null)
            {
                aoShapeValues[iRowOneBased, 1] =
                    oVertexShapeConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Shape.Value);
            }

            if (oEditedVertexAttributes.Radius.HasValue &&
                aoRadiusValues != null)
            {
                aoRadiusValues[iRowOneBased, 1] =
                    oEditedVertexAttributes.Radius.Value.ToString();
            }

            if (oEditedVertexAttributes.Alpha.HasValue &&
                aoAlphaValues != null)
            {
                aoAlphaValues[iRowOneBased, 1] =
                    oEditedVertexAttributes.Alpha.Value.ToString();
            }

            if (oEditedVertexAttributes.Visibility.HasValue &&
                aoVisibilityValues != null)
            {
                aoVisibilityValues[iRowOneBased, 1] =
                    oVertexVisibilityConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Visibility.Value);
            }

            if (oEditedVertexAttributes.LabelPosition.HasValue &&
                aoLabelPositionValues != null)
            {
                aoLabelPositionValues[iRowOneBased, 1] =
                    oVertexLabelPositionConverter.GraphToWorkbook(
                        oEditedVertexAttributes.LabelPosition.Value);
            }

            if (oEditedVertexAttributes.Locked.HasValue &&
                aoLockedValues != null)
            {
                aoLockedValues[iRowOneBased, 1] =
                    oBooleanConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Locked.Value);
            }

            if (oEditedVertexAttributes.Marked.HasValue &&
                aoMarkedValues != null)
            {
                aoMarkedValues[iRowOneBased, 1] =
                    oBooleanConverter.GraphToWorkbook(
                        oEditedVertexAttributes.Marked.Value);
            }
            }

            // Activate this worksheet first, because writing to an inactive
            // worksheet causes problems with the selection in Excel.

            ExcelActiveWorksheetRestorer oExcelActiveWorksheetRestorer =
            GetExcelActiveWorksheetRestorer();

            ExcelActiveWorksheetState oExcelActiveWorksheetState =
            oExcelActiveWorksheetRestorer.ActivateWorksheet(this.InnerObject);

            try
            {
            if (aoColorValues != null)
            {
                oColorColumnData.set_Value(Missing.Value, aoColorValues);
            }

            if (aoShapeValues != null)
            {
                oShapeColumnData.set_Value(Missing.Value, aoShapeValues);
            }

            if (aoRadiusValues != null)
            {
                oRadiusColumnData.set_Value(Missing.Value, aoRadiusValues);
            }

            if (aoAlphaValues != null)
            {
                oAlphaColumnData.set_Value(Missing.Value, aoAlphaValues);
            }

            if (aoVisibilityValues != null)
            {
                oVisibilityColumnData.set_Value(Missing.Value,
                    aoVisibilityValues);
            }

            if (aoLabelPositionValues != null)
            {
                oLabelPositionColumnData.set_Value(Missing.Value,
                    aoLabelPositionValues);
            }

            if (aoLockedValues != null)
            {
                oLockedColumnData.set_Value(Missing.Value, aoLockedValues);
            }

            if (aoMarkedValues != null)
            {
                oMarkedColumnData.set_Value(Missing.Value, aoMarkedValues);
            }
            }
            finally
            {
            oExcelActiveWorksheetRestorer.Restore(oExcelActiveWorksheetState);
            }

            Globals.ThisWorkbook.ShowWaitCursor = false;
        }
コード例 #6
0
        //*************************************************************************
        //  Method: TryGetVertexShape()
        //
        /// <summary>
        /// Attempts to get a vertex shape from a worksheet cell.
        /// </summary>
        ///
        /// <param name="oRow">
        /// Row containing the vertex data.
        /// </param>
        ///
        /// <param name="sColumnName">
        /// Name of the column containing the vertex shape.
        /// </param>
        ///
        /// <param name="eShape">
        /// Where the vertex shape gets stored if true is returned.
        /// </param>
        ///
        /// <returns>
        /// true if the specified cell contains a valid vertex shape.
        /// </returns>
        ///
        /// <remarks>
        /// If the specified shape cell is empty, false is returned.  If the cell
        /// contains a valid vertex shape, the shape gets stored at <paramref
        /// name="eShape" /> and true is returned.  If the cell contains an invalid
        /// shape, a <see cref="WorkbookFormatException" /> is thrown.
        /// </remarks>
        //*************************************************************************
        protected Boolean TryGetVertexShape(
            ExcelTableReader.ExcelTableRow oRow,
            String sColumnName,
            out VertexShape eShape
            )
        {
            Debug.Assert(oRow != null);
            Debug.Assert( !String.IsNullOrEmpty(sColumnName) );
            AssertValid();

            eShape = VertexShape.Circle;
            String sShape;

            if ( !oRow.TryGetNonEmptyStringFromCell(sColumnName, out sShape) )
            {
            return (false);
            }

            VertexShapeConverter oVertexShapeConverter =
            new VertexShapeConverter();

            if ( !oVertexShapeConverter.TryWorkbookToGraph(sShape, out eShape) )
            {
            OnWorkbookFormatErrorWithDropDown(oRow, sColumnName, "shape");
            }

            return (true);
        }
コード例 #7
0
 public void TearDown()
 {
     m_oVertexShapeConverter = null;
 }
コード例 #8
0
 public void SetUp()
 {
     m_oVertexShapeConverter = new VertexShapeConverter();
 }
コード例 #9
0
 //*************************************************************************
 //  Constructor: VertexShapeConverterTest()
 //
 /// <summary>
 /// Initializes a new instance of the <see
 /// cref="VertexShapeConverterTest" /> class.
 /// </summary>
 //*************************************************************************
 public VertexShapeConverterTest()
 {
     m_oVertexShapeConverter = null;
 }
コード例 #10
0
 SetUp()
 {
     m_oVertexShapeConverter = new VertexShapeConverter();
 }