Package org.apache.poi.hssf.record

Examples of org.apache.poi.hssf.record.DVRecord


       if (dataValidation == null) {
           throw new IllegalArgumentException("objValidation must not be null");
       }
       DataValidityTable dvt = _sheet.getOrCreateDataValidityTable();

       DVRecord dvRecord = dataValidation.createDVRecord(this);
       dvt.addDataValidation(dvRecord);
    }
View Full Code Here


       if (dataValidation == null) {
           throw new IllegalArgumentException("objValidation must not be null");
       }
       DataValidityTable dvt = _sheet.getOrCreateDataValidityTable();

       DVRecord dvRecord = dataValidation.createDVRecord(this);
       dvt.addDataValidation(dvRecord);
    }
View Full Code Here

            throw new IllegalArgumentException("objValidation must not be null");
        }
        HSSFDataValidation hssfDataValidation = (HSSFDataValidation) dataValidation;
        DataValidityTable dvt = _sheet.getOrCreateDataValidityTable();

        DVRecord dvRecord = hssfDataValidation.createDVRecord(this);
        dvt.addDataValidation(dvRecord);
    }
View Full Code Here

  public DVRecord createDVRecord(HSSFSheet sheet) {

    FormulaPair fp = _constraint.createFormulas(sheet);
   
    return new DVRecord(_constraint.getValidationType(),
        _constraint.getOperator(),
        _errorStyle, _emptyCellAllowed, getSuppressDropDownArrow(),
        _constraint.getValidationType()==ValidationType.LIST && _constraint.getExplicitListValues()!=null,
        _showPromptBox, _prompt_title, _prompt_text,
        _showErrorBox, _error_title, _error_text,
View Full Code Here

       if (dataValidation == null) {
           throw new IllegalArgumentException("objValidation must not be null");
       }
       DataValidityTable dvt = sheet.getOrCreateDataValidityTable();

       DVRecord dvRecord = dataValidation.createDVRecord(this);
       dvt.addDataValidation(dvRecord);
    }
View Full Code Here

  public DVRecord createDVRecord(HSSFSheet sheet) {

    FormulaPair fp = _constraint.createFormulas(sheet);
   
    return new DVRecord(_constraint.getValidationType(),
        _constraint.getOperator(),
        _errorStyle, _emptyCellAllowed, getSuppressDropDownArrow(),
        _constraint.isExplicitList(),
        _showPromptBox, _prompt_title, _prompt_text,
        _showErrorBox, _error_title, _error_text,
View Full Code Here

       if (dataValidation == null) {
           throw new IllegalArgumentException("objValidation must not be null");
       }
       DataValidityTable dvt = _sheet.getOrCreateDataValidityTable();

       DVRecord dvRecord = dataValidation.createDVRecord(this);
       dvt.addDataValidation(dvRecord);
    }
View Full Code Here

  public DVRecord createDVRecord(HSSFSheet sheet) {

    FormulaPair fp = _constraint.createFormulas(sheet);
   
    return new DVRecord(_constraint.getValidationType(),
        _constraint.getOperator(),
        _errorStyle, _emptyCellAllowed, getSuppressDropDownArrow(),
        _constraint.isExplicitList(),
        _showPromptBox, _prompt_title, _prompt_text,
        _showErrorBox, _error_title, _error_text,
View Full Code Here

           throw new IllegalArgumentException("objValidation must not be null");
       }
       HSSFDataValidation hssfDataValidation = (HSSFDataValidation)dataValidation;
       DataValidityTable dvt = _sheet.getOrCreateDataValidityTable();

       DVRecord dvRecord = hssfDataValidation.createDVRecord(this);
       dvt.addDataValidation(dvRecord);
    }
View Full Code Here

       }
       int curr_dvRecNo = dvalRec.getDVRecNo();
       dvalRec.setDVRecNo(curr_dvRecNo+1);

       //create dv record
       DVRecord dvRecord = new DVRecord();

       //dv record's option flags
       dvRecord.setDataType( obj_validation.getDataValidationType() );
       dvRecord.setErrorStyle(obj_validation.getErrorStyle());
       dvRecord.setEmptyCellAllowed(obj_validation.getEmptyCellAllowed());
       dvRecord.setSurppresDropdownArrow(obj_validation.getSurppressDropDownArrow());
       dvRecord.setShowPromptOnCellSelected(obj_validation.getShowPromptBox());
       dvRecord.setShowErrorOnInvalidValue(obj_validation.getShowErrorBox());
       dvRecord.setConditionOperator(obj_validation.getOperator());

       //string fields
       dvRecord.setStringField( DVRecord.STRING_PROMPT_TITLE,obj_validation.getPromptBoxTitle());
       dvRecord.setStringField( DVRecord.STRING_PROMPT_TEXT, obj_validation.getPromptBoxText());
       dvRecord.setStringField( DVRecord.STRING_ERROR_TITLE, obj_validation.getErrorBoxTitle());
       dvRecord.setStringField( DVRecord.STRING_ERROR_TEXT, obj_validation.getErrorBoxText());

       //formula fields ( size and data )
       String str_formula = obj_validation.getFirstFormula();
       FormulaParser fp = new FormulaParser(str_formula, workbook);
       fp.parse();
       Stack ptg_arr = new Stack();
       Ptg[] ptg  = fp.getRPNPtg();
       int size = 0;
       for (int k = 0; k < ptg.length; k++)
       {
           if ( ptg[k] instanceof org.apache.poi.hssf.record.formula.AreaPtg )
           {
              //we should set ptgClass to Ptg.CLASS_REF and explicit formula string to false
              ptg[k].setClass(Ptg.CLASS_REF);
              obj_validation.setExplicitListFormula(false);
           }
           size += ptg[k].getSize();
           ptg_arr.push(ptg[k]);
       }
       dvRecord.setFirstFormulaRPN(ptg_arr);
       dvRecord.setFirstFormulaSize((short)size);

       dvRecord.setListExplicitFormula(obj_validation.getExplicitListFormula());

       if ( obj_validation.getSecondFormula() != null )
       {
         str_formula = obj_validation.getSecondFormula();
         fp = new FormulaParser(str_formula, workbook);
         fp.parse();
         ptg_arr = new Stack();
         ptg  = fp.getRPNPtg();
         size = 0;
         for (int k = 0; k < ptg.length; k++)
         {
             size += ptg[k].getSize();
             ptg_arr.push(ptg[k]);
         }
         dvRecord.setSecFormulaRPN(ptg_arr);
         dvRecord.setSecFormulaSize((short)size);
       }

       //dv records cell range field
       HSSFCellRangeAddress cell_range = new HSSFCellRangeAddress();
       cell_range.addADDRStructure(obj_validation.getFirstRow(), obj_validation.getFirstColumn(), obj_validation.getLastRow(), obj_validation.getLastColumn());
       dvRecord.setCellRangeAddress(cell_range);

       //add dv record
       eofLoc = sheet.findFirstRecordLocBySid( EOFRecord.sid );
       sheet.getRecords().add( eofLoc, dvRecord );
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.DVRecord

Copyright © 2018 www.massapicom. 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.