예제 #1
0
        internal static void SetCellFormula(Shape shape, string cellName, string value)
        {
            string rowName     = cellName;
            string sectionName = "";

            if (cellName.Contains("."))
            {
                string[] tmp = cellName.Split('.');
                System.Diagnostics.Debug.Assert(tmp.Length == 2);
                sectionName = tmp[0];
                rowName     = tmp[1];
            }

            if (shape.get_CellExists(cellName, (short)VisExistsFlags.visExistsAnywhere) == 0)
            {
                // we should only be adding rows to the Prop or User sections
                System.Diagnostics.Debug.Assert(sectionName.ToUpper().Equals("PROP") || sectionName.ToUpper().Equals("USER"));

                if (sectionName.ToUpper().Equals("USER"))
                {
                    if (shape.get_SectionExists((short)VisSectionIndices.visSectionUser, (short)VisExistsFlags.visExistsAnywhere) == 0)
                    {
                        shape.AddSection((short)VisSectionIndices.visSectionUser);
                    }
                    shape.AddNamedRow((short)VisSectionIndices.visSectionUser, rowName, (short)VisRowTags.visTagDefault);
                }
                else
                {
                    if (shape.get_SectionExists((short)VisSectionIndices.visSectionProp, (short)VisExistsFlags.visExistsAnywhere) == 0)
                    {
                        shape.AddSection((short)VisSectionIndices.visSectionProp);
                    }
                    shape.AddNamedRow((short)VisSectionIndices.visSectionProp, rowName, (short)VisRowTags.visTagDefault);
                }
            }
            shape.get_Cells(cellName).Formula = value;
        }
예제 #2
0
        internal static void SetCellFormula(Shape shape, string cellName, string value)
        {
            string rowName = cellName;
            string sectionName = "";

            if (cellName.Contains(".")) {
                string[] tmp = cellName.Split('.');
                System.Diagnostics.Debug.Assert(tmp.Length == 2);
                sectionName = tmp[0];
                rowName = tmp[1];
            }

            if (shape.get_CellExists(cellName, (short)VisExistsFlags.visExistsAnywhere) == 0) {
                // we should only be adding rows to the Prop or User sections
                System.Diagnostics.Debug.Assert(sectionName.ToUpper().Equals("PROP") || sectionName.ToUpper().Equals("USER"));

                if (sectionName.ToUpper().Equals("USER")) {
                    if (shape.get_SectionExists((short)VisSectionIndices.visSectionUser, (short)VisExistsFlags.visExistsAnywhere) == 0)
                        shape.AddSection((short)VisSectionIndices.visSectionUser);
                    shape.AddNamedRow((short)VisSectionIndices.visSectionUser, rowName, (short)VisRowTags.visTagDefault);
                }
                else {
                    if (shape.get_SectionExists((short)VisSectionIndices.visSectionProp, (short)VisExistsFlags.visExistsAnywhere) == 0)
                        shape.AddSection((short)VisSectionIndices.visSectionProp);
                    shape.AddNamedRow((short)VisSectionIndices.visSectionProp, rowName, (short)VisRowTags.visTagDefault);
                }
            }
            shape.get_Cells(cellName).Formula = value;
        }