whitespace
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1716034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cd254f2f1e
commit
2fab3547be
@ -60,7 +60,6 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
public XSSFTable() {
|
||||
super();
|
||||
ctTable = CTTable.Factory.newInstance();
|
||||
|
||||
}
|
||||
|
||||
public XSSFTable(PackagePart part, PackageRelationship rel)
|
||||
@ -112,8 +111,8 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
|
||||
List<XSSFXmlColumnPr> pointers = getXmlColumnPrs();
|
||||
|
||||
for(XSSFXmlColumnPr pointer: pointers){
|
||||
if(pointer.getMapId()==id){
|
||||
for (XSSFXmlColumnPr pointer: pointers) {
|
||||
if (pointer.getMapId()==id) {
|
||||
maps=true;
|
||||
break;
|
||||
}
|
||||
@ -132,43 +131,34 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public String getCommonXpath() {
|
||||
|
||||
if(commonXPath == null){
|
||||
|
||||
String[] commonTokens ={};
|
||||
|
||||
for(CTTableColumn column :ctTable.getTableColumns().getTableColumnArray()){
|
||||
if(column.getXmlColumnPr()!=null){
|
||||
if (commonXPath == null) {
|
||||
String[] commonTokens = {};
|
||||
for (CTTableColumn column :ctTable.getTableColumns().getTableColumnArray()) {
|
||||
if (column.getXmlColumnPr()!=null) {
|
||||
String xpath = column.getXmlColumnPr().getXpath();
|
||||
String[] tokens = xpath.split("/");
|
||||
if(commonTokens.length==0){
|
||||
if (commonTokens.length==0) {
|
||||
commonTokens = tokens;
|
||||
|
||||
}else{
|
||||
} else {
|
||||
int maxLenght = commonTokens.length>tokens.length? tokens.length:commonTokens.length;
|
||||
for(int i =0; i<maxLenght;i++){
|
||||
if(!commonTokens[i].equals(tokens[i])){
|
||||
for (int i =0; i<maxLenght;i++) {
|
||||
if (!commonTokens[i].equals(tokens[i])) {
|
||||
List<String> subCommonTokens = Arrays.asList(commonTokens).subList(0, i);
|
||||
|
||||
String[] container = {};
|
||||
|
||||
commonTokens = subCommonTokens.toArray(container);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
commonXPath ="";
|
||||
|
||||
for(int i = 1 ; i< commonTokens.length;i++){
|
||||
commonXPath = "";
|
||||
for (int i = 1 ; i< commonTokens.length;i++) {
|
||||
commonXPath +="/"+commonTokens[i];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,10 +169,10 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<XSSFXmlColumnPr> getXmlColumnPrs() {
|
||||
|
||||
if(xmlColumnPr==null){
|
||||
if (xmlColumnPr==null) {
|
||||
xmlColumnPr = new ArrayList<XSSFXmlColumnPr>();
|
||||
for (CTTableColumn column:ctTable.getTableColumns().getTableColumnArray()){
|
||||
if (column.getXmlColumnPr()!=null){
|
||||
for (CTTableColumn column:ctTable.getTableColumns().getTableColumnArray()) {
|
||||
if (column.getXmlColumnPr()!=null) {
|
||||
XSSFXmlColumnPr columnPr = new XSSFXmlColumnPr(this,column,column.getXmlColumnPr());
|
||||
xmlColumnPr.add(columnPr);
|
||||
}
|
||||
@ -202,7 +192,7 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
* Changes the name of the Table
|
||||
*/
|
||||
public void setName(String name) {
|
||||
if(name == null) {
|
||||
if (name == null) {
|
||||
ctTable.unsetName();
|
||||
return;
|
||||
}
|
||||
@ -226,7 +216,7 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
/**
|
||||
* @return the number of mapped table columns (see Open Office XML Part 4: chapter 3.5.1.4)
|
||||
*/
|
||||
public long getNumerOfMappedColumns(){
|
||||
public long getNumerOfMappedColumns() {
|
||||
return ctTable.getTableColumns().getCount();
|
||||
}
|
||||
|
||||
@ -237,10 +227,9 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
*
|
||||
*/
|
||||
public CellReference getStartCellReference() {
|
||||
|
||||
if(startCellReference==null){
|
||||
if (startCellReference==null) {
|
||||
String ref = ctTable.getRef();
|
||||
if(ref != null) {
|
||||
if (ref != null) {
|
||||
String[] boundaries = ref.split(":");
|
||||
String from = boundaries[0];
|
||||
startCellReference = new CellReference(from);
|
||||
@ -255,9 +244,7 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
*
|
||||
*/
|
||||
public CellReference getEndCellReference() {
|
||||
|
||||
if(endCellReference==null){
|
||||
|
||||
if (endCellReference==null) {
|
||||
String ref = ctTable.getRef();
|
||||
String[] boundaries = ref.split(":");
|
||||
String from = boundaries[1];
|
||||
@ -271,14 +258,12 @@ public class XSSFTable extends POIXMLDocumentPart {
|
||||
* @return the total number of rows in the selection. (Note: in this version autofiltering is ignored)
|
||||
*
|
||||
*/
|
||||
public int getRowCount(){
|
||||
|
||||
|
||||
public int getRowCount() {
|
||||
CellReference from = getStartCellReference();
|
||||
CellReference to = getEndCellReference();
|
||||
|
||||
int rowCount = -1;
|
||||
if (from!=null && to!=null){
|
||||
if (from!=null && to!=null) {
|
||||
rowCount = to.getRow()-from.getRow();
|
||||
}
|
||||
return rowCount;
|
||||
|
Loading…
Reference in New Issue
Block a user