コード例 #1
0
        public void Setup(Command.CommandSetup command)
        {
            if (m_worksheet == null)
            {
                initializeWorksheet();
            }
            m_initializing = true;
            m_rowDict.Clear();
            m_columnDict.Clear();

            m_columnNum = command.Header.Count;
            m_rowNum    = command.Rows.Count;
            var initialTable = new object[m_rowNum + 1, m_columnNum + 1];

            m_dataTable  = new float[m_rowNum, m_columnNum];
            m_rowName    = new string[m_rowNum];
            m_columnName = new string[m_columnNum];

            initialTable[0, 0] = "";
            for (var j = 0; j < m_columnNum; j++)
            {
                initialTable[0, j + 1]          = command.Header[j];
                m_columnDict[command.Header[j]] = j;
                m_columnName[j] = command.Header[j];
            }
            for (var i = 0; i < m_rowNum; i++)
            {
                var rowData = command.Rows[i];
                initialTable[i + 1, 0]  = rowData.Name;
                m_rowDict[rowData.Name] = i;
                m_rowName[i]            = rowData.Name;
                for (var j = 0; j < m_columnNum; j++)
                {
                    if (j < rowData.Data.Count)
                    {
                        m_dataTable[i, j]          = rowData.Data[j];
                        initialTable[i + 1, j + 1] = rowData.Data[j];
                    }
                    else
                    {
                        m_dataTable[i, j]          = 0.0f;
                        initialTable[i + 1, j + 1] = 0.0f;
                    }
                }
            }
            m_worksheet.Cells.Clear();
            var start = m_worksheet.Range[
                m_worksheet.Cells[m_headerRow, m_headerColumn],
                m_worksheet.Cells[m_headerRow + m_rowNum, m_headerColumn + m_columnNum]
                        ];

            start.Value2   = initialTable;
            m_initializing = false;
        }
コード例 #2
0
 private void ExcecuteSetup(Command.CommandSetup command)
 {
     Setuped?.Invoke(command);
 }