Panel Schedule View - Get cell text

Panel Schedule View - Get cell text

latour_g
Explorer Explorer
193 Views
1 Reply
Message 1 of 2

Panel Schedule View - Get cell text

latour_g
Explorer
Explorer

Hi all,

 

I'm trying to export panel schedule content to Excel.  See image below, I'm able to export what's in yellow.  I still need to export what's in pink.

 

Here is the resume of what I tried : 

 

PanelScheduleView psv = psView as PanelScheduleView;
TableData table = psv.GetTableData();
TableSectionData section = table.GetSectionData(SectionType.Header);
int nRows = section.NumberOfRows;
int nColumns = section.NumberOfColumns;

xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(nCompteurFichier);
int nIndexLigne = 1;
int nIndexColonne = 1;

//HEADER
section = table.GetSectionData(SectionType.Header);
nRows = section.NumberOfRows;
nColumns = section.NumberOfColumns;

if (nRows > 1)
{
     for (int i = 0; i < nRows; i++)
     {
          for (int j = 0; j < nColumns; j++)
          {
               //xlWorkSheet.Cells[nIndexLigne, nIndexColonne] = psv.GetCellText(SectionType.Header, i, j);
                xlWorkSheet.Cells[nIndexLigne, nIndexColonne] = section.GetCellText(i, j);                                   
                 nIndexColonne++;
           }
            nIndexColonne = 1;
            nIndexLigne++;
      }
 }

//BODY
//I tried to look in PanelScheduleData and PanelScheduleView, samed result, empty
PanelScheduleData psd = psv.GetTableData();
section = psd.GetSectionData(SectionType.Body);
//section = table.GetSectionData(SectionType.Body);
nRows = section.NumberOfRows;
nColumns = section.NumberOfColumns;

//I did the same loop as for Header.  So on for Footer and Summary


So as you can see, I have tried 2 ways of getting celltext.

 

I managed to find information by doing the following but it look complicated to get all the data with a loop.

xlWorkSheet.Cells[1, 1] = (psv.GetCircuitByCell(3, 4)).CircuitNumber;
xlWorkSheet.Cells[2, 1] = (psv.GetCircuitByCell(3, 4)).LoadClassifications;
xlWorkSheet.Cells[3, 1] = (psv.GetCircuitByCell(3, 4)).LoadName;
xlWorkSheet.Cells[4, 1] = (psv.GetCircuitByCell(3, 4)).PanelName;
xlWorkSheet.Cells[5, 1] = (psv.GetCircuitByCell(3, 4)).PhaseLabel;

 

I don't understand why I'm only getting the content in yellow ? 
Also I'm not sure what's the difference between PanelScheduleView and PanelScheduleData ?


Thanks in advance for your help.

 

 

0 Likes
194 Views
1 Reply
Reply (1)
Message 2 of 2

longt61
Advocate
Advocate

I have not work with Panel Schedule, only with Quantity Schedule, and here is my take: Instead of working PanelScheduleData, try work with TableSectionData. It contains more information for your need.

PanelScheduleView.GetSectionData(SectionType sectionType);
TableSectionData.GetCellText(int nRow, int nCol);

 As for you extra question:

  - PanelScheduleView: as the name suggest, it is just a view in Revit containing data and elements inside, similar to a floor plan view containing floors and walls. The only different is that ,for schedule views in general and PanelScheduleView in particular, they do not contain 3D geometry data but the non-geometry data. 

  - PanelScheduleData: it is the data for the view, determine how it should display its content, such as Border data, column data, etc.. Keep in mind that this is just a part of the data, other data can be store in ScheduleDefinition, TableSectionData, etc..

0 Likes