private bool WriteNode(string fileName, NodeArchiveSource source)
        {
            var node  = source.Node;
            var excel = new Application();

            //excel.Visible = true;
            excel.DisplayAlerts = false;
            var workbooks = excel.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
            var worksheet = (Worksheet)workbooks.Worksheets[1];

            worksheet.Name = "NodeEvent-" + node.Duration;

            var column = 1;

            worksheet.Cells[FrameTreeType.Function][column]     = "FUNCTION";
            worksheet.Cells[FrameTreeType.SelfDuration][column] = "SELFDURATION(MS)";
            worksheet.Cells[FrameTreeType.SelfPercent][column]  = "SELFPERCENT%";
            worksheet.Cells[FrameTreeType.Total][column]        = "TOTAL(MS)";
            worksheet.Cells[FrameTreeType.TotalPercent][column] = "TOTALPERCENT%";
            worksheet.Cells[FrameTreeType.Path][column]         = "PATH";
            worksheet.Cells[FrameTreeType.Tags][column]         = "TAGS";

            if (node is EventNode)
            {
                WriteEventNode(worksheet, ref column, node as EventNode);
            }

            workbooks.SaveCopyAs(fileName);
            workbooks.Close();
            excel.Quit();

            return(true);
        }
Exemple #2
0
        private bool WriteNode(string fileName, NodeArchiveSource source)
        {
            var node   = source.Node;
            var writer = new StreamWriter(fileName, false, Encoding.UTF8);

            writer.WriteLine(@"FUNCTION,SELFDURATION(MS),SELFPERCENT,TOTAL(MS),TOTALPERCENT%,PATH,TAGS");

            if (node is EventNode)
            {
                WriteEventNode(writer, node as EventNode);
            }
            writer.Close();

            return(true);
        }