};\r
\r
Element n = document.getDocumentElement();\r
- DOMSignContext domSignContext = new DOMSignContext(key, n, nextSibling);\r
+ DOMSignContext domSignContext = (nextSibling == null)\r
+ ? new DOMSignContext(key, n)\r
+ : new DOMSignContext(key, n, nextSibling);\r
for (Map.Entry<String,String> me : signatureConfig.getNamespacePrefixes().entrySet()) {\r
domSignContext.putNamespacePrefix(me.getKey(), me.getValue());\r
}\r
* @return the local XPath
*/
public String getLocalXPath(){
- String localXPath = "";
+ StringBuilder localXPath = new StringBuilder();
int numberOfCommonXPathAxis = table.getCommonXpath().split("/").length-1;
String[] xPathTokens = ctXmlColumnPr.getXpath().split("/");
for(int i=numberOfCommonXPathAxis; i<xPathTokens.length;i++){
- localXPath += "/" +xPathTokens[i];
+ localXPath.append("/" +xPathTokens[i]);
}
- return localXPath;
+ return localXPath.toString();
}
public Enum getXmlDataType() {
return hdr;
}
- private CTHdrFtr buildHdrFtr(String pStyle, XWPFParagraph[] paragraphs) {
- CTHdrFtr ftr = CTHdrFtr.Factory.newInstance();
- if (paragraphs != null) {
- for (int i = 0; i < paragraphs.length; i++) {
- CTP p = ftr.addNewP();
- //ftr.setPArray(0, paragraphs[i].getCTP()); // MB 23 May 2010
- ftr.setPArray(i, paragraphs[i].getCTP()); // MB 23 May 2010
- }
- } else {
- CTP p = ftr.addNewP();
- byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
- byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
- p.setRsidP(rsidr);
- p.setRsidRDefault(rsidrdefault);
- CTPPr pPr = p.addNewPPr();
- pPr.addNewPStyle().setVal(pStyle);
- }
- return ftr;
- }
-
/**
* MB 24 May 2010. Created this overloaded buildHdrFtr() method because testing demonstrated
* that the XWPFFooter or XWPFHeader object returned by calls to the createHeader(int, XWPFParagraph[])
public XWPFVertAlign getVerticalAlignment() {\r
XWPFVertAlign vAlign = null;\r
CTTcPr tcpr = ctTc.getTcPr();\r
- if (ctTc != null) {\r
+ if (tcpr != null) {\r
CTVerticalJc va = tcpr.getVAlign();\r
vAlign = stVertAlignTypeMap.get(va.getVal().intValue());\r
}\r
if (table == null) {\r
return null;\r
}\r
- XWPFTableRow tableRow = table.getRow(row);\r
- if (tableRow == null) {\r
+ XWPFTableRow tr = table.getRow(row);\r
+ if (tr == null) {\r
return null;\r
}\r
- return tableRow.getTableCell(cell);\r
+ return tr.getTableCell(cell);\r
}\r
\r
public XWPFDocument getXWPFDocument() {\r