Exemplo n.º 1
0
        private VNC.AddinHelper.Excel.XlLocation DisplayListOf_Lists(VNC.AddinHelper.Excel.XlLocation insertAt, IEnumerable <List> lists, bool displayDataOnly, string tableSuffix)
        {
            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt);

            Worksheet ws = insertAt.workSheet;

            if (!displayDataOnly)
            {
                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Title");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Id");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "SchemaXml");

                insertAt.IncrementRows();
            }

            foreach (var list in lists)
            {
                insertAt.ClearOffsets();

                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), list.Title);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), list.Id.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), list.SchemaXml);

                insertAt.IncrementRows();
            }

            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End");

            return(insertAt);
        }
Exemplo n.º 2
0
        private XlHlp.XlLocation DisplayListOf_ContentTypes(XlHlp.XlLocation insertAt, ContentTypeCollection contentTypes, bool displayDataOnly, string tableSuffix)
        {
            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt);

            Worksheet ws = insertAt.workSheet;

            if (!displayDataOnly)
            {
                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Name");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Group");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Id");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "SchemaXml");

                insertAt.IncrementRows();
            }

            foreach (var cType in contentTypes)
            {
                insertAt.ClearOffsets();

                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.Name);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.Group);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.Id.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), cType.SchemaXml);

                insertAt.IncrementRows();
            }

            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End");

            return(insertAt);
        }
Exemplo n.º 3
0
        XlHlp.XlLocation AddSection_ChildNodes(
            XlHlp.XlLocation insertAt,
            string NodeType,
            ReadOnlyCollection <CatalogNode> childNodes)
        {
            //XlHlp.DisplayInWatchWindow(insertAt);

            //// List the team project collections

            XlHlp.AddContentToCell(insertAt.InsertRow(1), string.Format("{0}({1})", NodeType, childNodes.Count));

            //currentRow = startingRow;
            //int innerRowsAdded = 0;
            //int col = 1;

            //foreach (CatalogNode child in childNodes)
            //{
            //    // Need to fix this so expands down the page
            //    innerRowsAdded = AddSection_CatalogNode(ws, rngOutput, child);
            //    insertAt = innerRowsAdded;
            //    currentRow += innerRowsAdded;
            //}

            //XlLocation.Rows++;

            return(insertAt);
        }
Exemplo n.º 4
0
        private XlHlp.XlLocation DisplayListOf_SiteColumns(XlHlp.XlLocation insertAt, IEnumerable <Field> siteColumns, bool displayDataOnly, string tableSuffix)
        {
            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt);

            Worksheet ws = insertAt.workSheet;

            //<Field
            //ID="{56747800-D36E-4625-ABE3-B1BC74A7D5F8}"
            //Name="LowerValuesAreBetter"
            //StaticName="LowerValuesAreBetter"
            //Description="Whether lower is better or higher is better"
            //Group="Status Indicators" Type="Boolean"
            //DisplayName="Lower values are better"
            //SourceID="http://schemas.microsoft.com/sharepoint/v3" />

            //<Field
            //Type="Lookup"
            //DisplayName="FA Page Type"
            //Required="FALSE"
            //EnforceUniqueValues="FALSE"
            //List="{b1d6a5ff-876b-4761-a05d-210038e31639}"
            //WebId="666b287f-2709-476b-a739-e1de9150fb37"
            //ShowField="Title"
            //UnlimitedLengthInDocumentLibrary="FALSE"
            //Group="Custom Columns"
            //ID="{3090abc3-526c-458f-9c65-302ad853db65}"
            //SourceID="{666b287f-2709-476b-a739-e1de9150fb37}"
            //StaticName="FA_x0020_Page_x0020_Type"
            //Name="FA_x0020_Page_x0020_Type" />


            if (!displayDataOnly)
            {
                insertAt.MarkStart(XlHlp.MarkType.GroupTable);

                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Title");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Name");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "StaticName");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 40, "Description");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 30, "Group");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "Id");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 15, "TypeAsString");
                XlHlp.AddColumnHeaderToSheet(insertAt.AddOffsetColumn(), 20, "SchemaXml");

                insertAt.IncrementRows();
            }

            foreach (var field in siteColumns)
            {
                insertAt.ClearOffsets();

                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.Title);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.Group);
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.Id.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.TypeAsString.ToString());
                XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), field.SchemaXml);

                insertAt.IncrementRows();
            }

            XlHlp.DisplayInWatchWindow(System.Reflection.MethodInfo.GetCurrentMethod().Name, insertAt, "End");

            return(insertAt);
        }
Exemplo n.º 5
0
        private void CreateWorksheet_Web_Info(ClientContext ctx, string sectionsToDisplay, bool orientVertical)
        {
            XlHlp.DisplayInWatchWindow(string.Format("{0}",
                                                     System.Reflection.MethodInfo.GetCurrentMethod().Name));

            var web = ctx.Web;

            ctx.Load(web);
            ctx.ExecuteQuery();

            string    sheetName = XlHlp.SafeSheetName(string.Format("{0}{1}", "SPWeb>", web.Title));
            Worksheet ws        = XlHlp.NewWorksheet(sheetName, beforeSheetName: "FIRST");

            XlHlp.XlLocation insertAt = new XlHlp.XlLocation(ws, row: 2, column: 1, orientVertical: GetDisplayOrientation());

            if (insertAt.OrientVertical)
            {
                XlHlp.AddContentToCell(insertAt.AddRow(), "Web Info", 14, XlHlp.MakeBold.Yes);
                insertAt.IncrementRows();
            }
            else
            {
                XlHlp.AddContentToCell(insertAt.AddRow(), "Web Info", 14, XlHlp.MakeBold.Yes, orientation: XlOrientation.xlUpward);
                insertAt.DecrementRows();   // AddRow bumped it.
                insertAt.IncrementColumns();
            }

            if (sectionsToDisplay.Contains("WebInfo"))
            {
                insertAt = AddSection_WebInfo(insertAt, ctx, web);

                insertAt.IncrementPosition(insertAt.OrientVertical);
            }

            if (sectionsToDisplay.Contains("Libraries"))
            {
                insertAt = AddSection_Libraries(insertAt, ctx, web);

                insertAt.IncrementPosition(insertAt.OrientVertical);
            }

            if (sectionsToDisplay.Contains("Lists"))
            {
                insertAt = AddSection_Lists(insertAt, ctx, web);

                insertAt.IncrementPosition(insertAt.OrientVertical);
            }

            if (sectionsToDisplay.Contains("SiteGroups"))
            {
                insertAt = AddSection_SiteGroups(insertAt, ctx, web);

                insertAt.IncrementPosition(insertAt.OrientVertical);
            }

            if (sectionsToDisplay.Contains("SiteColumns"))
            {
                insertAt = AddSection_SiteColumns(insertAt, ctx, web);

                insertAt.IncrementPosition(insertAt.OrientVertical);
            }

            if (sectionsToDisplay.Contains("ContentTypes"))
            {
                insertAt = AddSection_ContentTypes(insertAt, ctx, web);

                insertAt.IncrementPosition(insertAt.OrientVertical);
            }
        }
Exemplo n.º 6
0
        private void btnTimeInsertAtLight_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Office.Interop.Excel.Application app = Globals.ThisAddIn.Application;

            teDuration.Clear();

            int insertRow;
            int insertCol;
            int iterations;

            if (!int.TryParse(teStartRow.Text, out insertRow))
            {
                MessageBox.Show("Illegal StartRow");
                teStartRow.Focus();
                return;
            }

            if (!int.TryParse(teStartCol.Text, out insertCol))
            {
                MessageBox.Show("Illegal StartCol");
                teStartCol.Focus();
                return;
            }

            if (!int.TryParse(teIterations.Text, out iterations))
            {
                MessageBox.Show("Illegal Iterations");
                teIterations.Focus();
                return;
            }

            if (!(bool)ceScreenUpdates.IsChecked)
            {
                XlHlp.ScreenUpdatesOff();
            }

            if (!(bool)ceCalculations.IsChecked)
            {
                XlHlp.CalculationsOff();
            }

            long startTicks = XlHlp.DisplayInWatchWindow("Start");

            if ((bool)ceInsertDescending.IsChecked)
            {
                XlHlp.XlLocation insertAt = new XlHlp.XlLocation(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet, insertRow, insertCol);

                insertRow += iterations;

                for (int i = 0; i < iterations; i++)
                {
                    XlHlp.AddContentToCell(insertAt.AddRowX(), string.Format("{0,5}-1", insertRow + i));
                }
            }
            else
            {
                XlHlp.XlLocation insertAt = new XlHlp.XlLocation(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet, insertRow, insertCol);

                for (int i = 0; i < iterations; i++)
                {
                    XlHlp.AddContentToCell(insertAt.AddRowX(), string.Format("{0,5}-1", insertRow + i));
                }
            }

            long endTicks = XlHlp.DisplayInWatchWindow("End", startTicks);

            teDuration.Text = ((endTicks - startTicks) / ((double)Stopwatch.Frequency)).ToString();

            XlHlp.ScreenUpdatesOn(true);
            XlHlp.CalculationsOn();
        }
Exemplo n.º 7
0
        internal static void Add_TP_Changesets(
            XlHlp.XlLocation insertAt,
            Options_AZDO_TFS options,
            ICommonStructureService commonStructureService,
            bool listChanges, bool listWorkItems, IEnumerable history)
        {
            Int64 startTicks = Log.APPLICATION("Enter", Common.LOG_CATEGORY);

            foreach (Changeset changeset in history)
            {
                insertAt.ClearOffsets();

                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.ChangesetId.ToString());
                //XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), changeset.CheckinNote.ToString());
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Committer);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.CommitterDisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Owner);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.OwnerDisplayName);
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.CreationDate.ToString());
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.CheckinNote.ToString());
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Comment);
                //XlHlp.AddContentToCell(insertAt.AddOffsetColumn(), changeset.AssociatedWorkItems.Count().ToString());
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.Changes.Count().ToString());
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.WorkItems.Count().ToString());
                XlHlp.AddOffsetContentToCell(insertAt.AddOffsetColumn(), changeset.AssociatedWorkItems.Count().ToString());

                insertAt.IncrementRows();

                if (listChanges)
                {
                    insertAt.IncrementColumns();

                    foreach (Change change in changeset.Changes)
                    {
                        try
                        {
                            XlHlp.AddContentToCell(insertAt.AddRowX(1), Section_VersionControlServer.GetChangeInfo(change));
                            //XlHlp.AddContentToCell(insertAt.AddRow(), GetIterationInfo(workItem));
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                    }

                    insertAt.DecrementColumns();
                }

                if (listWorkItems)
                {
                    insertAt.IncrementColumns();

                    foreach (WorkItem workItem in changeset.WorkItems)
                    {
                        try
                        {
                            XlHlp.AddContentToCell(insertAt.AddRowX(1), Section_VersionControlServer.GetWorkItemInfo(workItem));
                            XlHlp.AddContentToCell(insertAt.AddRowX(1), Section_VersionControlServer.GetIterationInfo(workItem, commonStructureService));
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                    }

                    insertAt.DecrementColumns();
                }
            }

            Log.APPLICATION("Exit", Common.LOG_CATEGORY, startTicks);
        }