Examples of XSSFRow


Examples of org.apache.poi.xssf.usermodel.XSSFRow

        cttable.setTotalsRowCount(1);
       
        CTTableColumns columns = cttable.addNewTableColumns();
        columns.setCount(3);
        CTTableColumn column;
        XSSFRow row;
        XSSFCell cell;
        for(int i=0; i<3; i++) {
            //Create column
            column = columns.addNewTableColumn();
            column.setName("Column");
            column.setId(i+1);
            //Create row
            row = sheet.createRow(i);
            for(int j=0; j<3; j++) {
                //Create cell
                cell = row.createCell(j);
                if(i == 0) {
                    cell.setCellValue("Column"+j);
                } else {
                    cell.setCellValue("0");
                }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

            CTStrVal sVal = strData.addNewPt();
            sVal.setIdx(idx);
            sVal.setV(key);

            idx++;
            XSSFRow row = sheet.createRow(rownum++);
            row.createCell(0).setCellValue(key);
            row.createCell(1).setCellValue(val);
        }
        numData.getPtCount().setVal(idx);
        strData.getPtCount().setVal(idx);

        String numDataRange = new CellRangeAddress(1, rownum-1, 1, 1).formatAsString(sheet.getSheetName(), true);
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

                    startRow +=1;

                    int endRow = table.getEndCellReference().getRow();

                    for(int i = startRow; i<= endRow; i++) {
                        XSSFRow row = sheet.getRow(i);

                        Node tableRootNode = getNodeByXPath(table.getCommonXpath(),doc.getFirstChild(),doc,true);

                        short startColumnIndex = table.getStartCellReference().getCol();
                        for(int j = startColumnIndex; j<= table.getEndCellReference().getCol();j++) {
                            XSSFCell cell = row.getCell(j);
                            if (cell!=null) {
                                XSSFXmlColumnPr pointer = tableColumns.get(j-startColumnIndex);
                                String localXPath = pointer.getLocalXPath();
                                Node currentNode = getNodeByXPath(localXPath,tableRootNode,doc,false);
                                STXmlDataType.Enum dataType = pointer.getXmlDataType();
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

                    String nodeXPath = commonXPath + "[" + (i + 1) + "]" + localXPath;

                    // TODO: convert the data to the cell format
                    String value = (String) xpath.evaluate(nodeXPath, result.item(i), XPathConstants.STRING);
                    logger.log(POILogger.DEBUG, "Extracting with xpath " + nodeXPath + " : value is '" + value + "'");
                    XSSFRow row = table.getXSSFSheet().getRow(rowId);
                    if (row == null) {
                        row = table.getXSSFSheet().createRow(rowId);
                    }

                    XSSFCell cell = row.getCell(columnId);
                    if (cell == null) {
                        cell = row.createCell(columnId);
                    }
                    logger.log(POILogger.DEBUG, "Setting '" + value + "' to cell " + cell.getColumnIndex() + "-" + cell.getRowIndex() + " in sheet "
                                                    + table.getXSSFSheet().getSheetName());
                    cell.setCellValue(value.trim());
                }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

                        + "and/or Student worksheets");
                course = null;
            } else
            {
                LOGGER.debug("course, sections, students, and instructors worksheets found");
                XSSFRow courseRow = courseSheet.getRow(0);
                course = new Course(courseRow.getCell(0).getStringCellValue());
                LOGGER.debug("Course Name: " + course.getName());
                sections = (ArrayList<Section>) importSections(sectionSheet, course);
                if (sections.size() > 0)
                {
                    int count = 0;
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

        {
            try
            {
                int totalRows = sectionSheet.getPhysicalNumberOfRows();
                LOGGER.debug("Total Rows in Section Worksheet: " + totalRows);
                XSSFRow headerRow = sectionSheet.getRow(0);
                String headerCell1 = headerRow.getCell(0).getStringCellValue();
                if (headerCell1.isEmpty() || !headerCell1.equals("Section"))
                {
                    LOGGER.error("Section sheet is missing a proper header row");
                    sections = null;
                } else
                {
                    LOGGER.debug("Header information correct");
                    for (int i = 1; i < totalRows; i++)
                    {
                        LOGGER.debug("Parsing Section Row #" + i);
                        XSSFRow sectionRow = sectionSheet.getRow(i);
                        Section section = new Section(sectionRow.getCell(0).getStringCellValue());
                        section.setCourse(course);
                        if (!sections.contains(section))
                        {
                            LOGGER.debug("Adding Section " + section.getName()
                                    + " to Course " + course);
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

            try
            {
                int totalRows = instructorSheet.getPhysicalNumberOfRows();
                LOGGER.debug("Total Rows in Instructor Worksheet: " + totalRows);
                // Verify the Header row exists and contains the right columns
                XSSFRow headerRow = instructorSheet.getRow(0);
                String headerCell1 = headerRow.getCell(0).getStringCellValue();
                String headerCell2 = headerRow.getCell(1).getStringCellValue();
                String headerCell3 = headerRow.getCell(2).getStringCellValue();
                String headerCell4 = headerRow.getCell(3).getStringCellValue();
                String headerCell5 = headerRow.getCell(4).getStringCellValue();

                if (headerCell1.isEmpty() || !headerCell1.equals("Login")
                        || headerCell2.isEmpty() || !headerCell2.equals("Password")
                        || headerCell3.isEmpty() || !headerCell3.equals("First Name")
                        || headerCell4.isEmpty() || !headerCell4.equals("Last Name")
                        || headerCell5.isEmpty() || !headerCell5.equals("Section"))
                {
                    LOGGER.error("Instructor sheet is missing a proper header row");
                    instructors = null;
                } else
                {
                    LOGGER.debug("Header information correct");
                    for (int i = 1; i < totalRows; i++)
                    {
                        LOGGER.debug("Parsing Instructor Row #" + i);
                        XSSFRow instructorRow = instructorSheet.getRow(i);
                        Instructor instructor = new Instructor();
                        instructor.setDomainAccount(instructorRow.getCell(0).getStringCellValue());
                        instructor.setWebID(instructorRow.getCell(0).getStringCellValue());
                        instructor.setPassword(instructorRow.getCell(1).getStringCellValue());
                        instructor.setFirstName(instructorRow.getCell(2).getStringCellValue());
                        instructor.setLastName(instructorRow.getCell(3).getStringCellValue());

                        /**
                         * The assumption is that all Course Sections will be
                         * identified prior to loading instructors.
                         */
                        Section importedSection = new Section();
                        importedSection.setName(instructorRow.getCell(4).getStringCellValue());
                        importedSection.setCourse(course);
                        int sectionIndex = sections.indexOf(importedSection);

                        int instructorIndex = instructors.indexOf(instructor);
                        if (instructorIndex > -1)
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

            try
            {
                int totalRows = studentSheet.getPhysicalNumberOfRows();
                LOGGER.debug("Total Rows in Student Worksheet: " + totalRows);
                // Verify the Header row exists and contains the right columns
                XSSFRow headerRow = studentSheet.getRow(0);
                // Cell A1: Year
                String headerCell1 = headerRow.getCell(0).getStringCellValue();
                // We're ignoring Cell B1 since it contains email--not stored at
                // this time.  Cell B1 should contain "Possible Email"
               
                // Cell C1: Login Name
                String headerCell2 = headerRow.getCell(2).getStringCellValue();
                // Cell D1: First Name
                String headerCell3 = headerRow.getCell(3).getStringCellValue();
                // Cell E1: Last Name
                String headerCell4 = headerRow.getCell(4).getStringCellValue();
                // Cell F1: Section
                String headerCell5 = headerRow.getCell(5).getStringCellValue();

                if (headerCell1.isEmpty() || !headerCell1.equals("Year")
                        || headerCell2.isEmpty() || !headerCell2.equals("Login Name")
                        || headerCell3.isEmpty() || !headerCell3.equals("First Name")
                        || headerCell4.isEmpty() || !headerCell4.equals("Last Name")
                        || headerCell5.isEmpty() || !headerCell5.equals("Section"))
                {
                    LOGGER.error("Student sheet is missing a proper header row");
                } else
                {
                    LOGGER.debug("Header information correct");
                    for (int i = 1; i < totalRows; i++)
                    {
                        LOGGER.debug("Parsing Student Row #" + i);
                        XSSFRow studentRow = studentSheet.getRow(i);
                        Student student = new Student();
                        student.setWebID(studentRow.getCell(2).getStringCellValue());
                        LOGGER.debug("Student Web ID: " + student.getWebID());
                        student.setFirstName(studentRow.getCell(3).getStringCellValue());
                        LOGGER.debug("Student First Name: " + student.getFirstName());
                        student.setLastName(studentRow.getCell(4).getStringCellValue());
                        LOGGER.debug("Student Last Name: " + student.getLastName());
                        Double tempClassYear = new Double(studentRow.getCell(0).getNumericCellValue());
                        LOGGER.debug("Class Year (Temp): " + tempClassYear);

                        student.setClassYear(new Integer(tempClassYear.intValue()));
                        LOGGER.debug("Student Class Year: " + student.getClassYear());

                        /**
                         * The assumption is that all Course Sections will be
                         * identified prior to loading students.
                         */
                        Section importedSection = new Section();
                        importedSection.setName(studentRow.getCell(5).getStringCellValue());
                        importedSection.setCourse(course);

                        int sectionIndex = sections.indexOf(importedSection);

                        int studentIndex = students.indexOf(student);
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

         
         
          // TODO: convert the data to the cell format 
          String value = (String) xpath.evaluate(nodeXPath,result.item(i), XPathConstants.STRING);
          logger.log(POILogger.DEBUG,"Extracting with xpath "+nodeXPath+" : value is '"+value+"'");
          XSSFRow row = table.getXSSFSheet().getRow(rowId);
          if(row==null){
            row = table.getXSSFSheet().createRow(rowId);
          }
         
          XSSFCell cell = row.getCell(columnId);
          if(cell==null){
            cell = row.createCell(columnId);
          }
          logger.log(POILogger.DEBUG,"Setting '"+value+"' to cell "+cell.getColumnIndex()+"-"+cell.getRowIndex()+" in sheet "+table.getXSSFSheet().getSheetName());
          cell.setCellValue(value.trim());
         
        }
View Full Code Here

Examples of org.apache.poi.xssf.usermodel.XSSFRow

                  startRow +=1;
                 
                  int endRow = table.getEndCellReference().getRow();
                 
                  for(int i = startRow; i<= endRow; i++){
                    XSSFRow row = sheet.getRow(i);
                   
                    Node tableRootNode = getNodeByXPath(table.getCommonXpath(),doc.getFirstChild(),doc,true);
                   
                    short startColumnIndex = table.getStartCellReference().getCol();
                    for(int j = startColumnIndex; j<= table.getEndCellReference().getCol();j++){
                      XSSFCell cell = row.getCell(j);
                      if(cell!=null){
                        XSSFXmlColumnPr pointer = tableColumns.get(j-startColumnIndex);
                        String localXPath = pointer.getLocalXPath();
                        Node currentNode = getNodeByXPath(localXPath,tableRootNode,doc,false);
                        STXmlDataType.Enum dataType = pointer.getXmlDataType();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.