import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
import static org.apache.poi.xssf.usermodel.helpers.XSSFPasswordHelper.setPassword;
import static org.apache.poi.xssf.usermodel.helpers.XSSFPasswordHelper.validatePassword;
+import static org.openxmlformats.schemas.spreadsheetml.x2006.main.STRefMode.*;
import java.io.File;
import java.io.IOException;
setPrintArea(sheetIndex, reference);
}
+ @Override
+ public Boolean usesR1C1CellReferences() {
+ final CTCalcPr calcPr = getCTWorkbook().getCalcPr();
+ if (calcPr == null) {
+ return null;
+ } else if (calcPr.getRefMode() == R_1_C_1) {
+ return Boolean.TRUE;
+ } else if (calcPr.getRefMode() == A_1) {
+ return Boolean.FALSE;
+ }
+ return null;
+ }
+
private static String getReferencePrintArea(String sheetName, int startC, int endC, int startR, int endR) {
//windows excel example: Sheet1!$C$3:$E$4
CellReference colRef = new CellReference(sheetName, startR, startC, true, true);
import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.model.RecordStream;
import org.apache.poi.hssf.model.WorkbookRecordList;
-import org.apache.poi.hssf.record.AbstractEscherHolderRecord;
-import org.apache.poi.hssf.record.BackupRecord;
-import org.apache.poi.hssf.record.BoundSheetRecord;
-import org.apache.poi.hssf.record.DrawingGroupRecord;
-import org.apache.poi.hssf.record.ExtendedFormatRecord;
-import org.apache.poi.hssf.record.FilePassRecord;
-import org.apache.poi.hssf.record.FontRecord;
-import org.apache.poi.hssf.record.FormatRecord;
-import org.apache.poi.hssf.record.LabelRecord;
-import org.apache.poi.hssf.record.LabelSSTRecord;
-import org.apache.poi.hssf.record.NameRecord;
-import org.apache.poi.hssf.record.RecalcIdRecord;
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.hssf.record.RecordFactory;
-import org.apache.poi.hssf.record.SSTRecord;
-import org.apache.poi.hssf.record.UnknownRecord;
+import org.apache.poi.hssf.record.*;
import org.apache.poi.hssf.record.aggregates.RecordAggregate.RecordVisitor;
import org.apache.poi.hssf.record.common.UnicodeString;
import org.apache.poi.hssf.record.crypto.Biff8DecryptingStream;
return newName;
}
+ @Override
+ public Boolean usesR1C1CellReferences() {
+ for (HSSFSheet hssfSheet : _sheets) {
+ InternalSheet internalSheet = hssfSheet.getSheet();
+
+ List<RecordBase> records = internalSheet.getRecords();
+
+ RefModeRecord refModeRecord = null;
+ for (RecordBase record : records) {
+ if (record instanceof RefModeRecord) refModeRecord = (RefModeRecord)record;
+ }
+ if (refModeRecord == null) {
+ return null;
+ } else if (refModeRecord.getMode() == RefModeRecord.USE_R1C1_MODE) {
+ return Boolean.TRUE;
+ } else if (refModeRecord.getMode() == RefModeRecord.USE_A1_MODE) {
+ return Boolean.FALSE;
+ }
+ }
+ return null;
+ }
+
int getNameIndex(String name) {
for (int k = 0; k < names.size(); k++) {