Skip to content

Commit

Permalink
xpt报表增加套打支持,Excel模型增加图片读写
Browse files Browse the repository at this point in the history
  • Loading branch information
entropy-cloud committed Sep 25, 2023
1 parent 28fded0 commit 2c46266
Show file tree
Hide file tree
Showing 39 changed files with 745 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static ByteString from(Object value, Function<ErrorCode, NopException> er
}

public boolean isEmpty() {
return bytes.length <= 0;
return bytes.length == 0;
}

public int size() {
Expand Down
6 changes: 5 additions & 1 deletion nop-core/src/main/java/io/nop/core/lang/xml/XNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
import io.nop.core.model.tree.TreeVisitResult;
import io.nop.core.model.tree.TreeVisitors;
import io.nop.core.resource.IResource;
import jakarta.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.annotation.Nonnull;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
Expand Down Expand Up @@ -393,6 +393,10 @@ public void content(SourceLocation loc, Object value) {
this.content = content == null || content.isEmpty() ? NULL_VALUE : content;
}

public int contentAsInt(int defaultValue) {
return ConvertHelper.toPrimitiveInt(getContentValue(), defaultValue, err -> new NopException(err).param(ARG_NODE, this));
}

public boolean isCDataText() {
return content.isCDataText();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public ByteArrayResource(String path, byte[] data, long lastModified) {
this.lastModified = lastModified;
}

public byte[] getData(){
return data;
}

@Override
protected Object internalObj() {
return data;
Expand Down
20 changes: 20 additions & 0 deletions nop-excel/src/main/java/io/nop/excel/model/ExcelClientAnchor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,30 @@
*/
package io.nop.excel.model;

import io.nop.core.model.table.CellPosition;
import io.nop.excel.model._gen._ExcelClientAnchor;

public class ExcelClientAnchor extends _ExcelClientAnchor {
public ExcelClientAnchor() {

}

public ExcelClientAnchor copy(){
ExcelClientAnchor ret = new ExcelClientAnchor();
ret.setRow1(getRow1());
ret.setCol1(getCol1());

ret.setRowDelta(getRowDelta());
ret.setColDelta(getColDelta());
ret.setDx1(getDx1());
ret.setDx2(getDx2());
ret.setDy1(getDy1());
ret.setDy2(getDy2());
ret.setType(getType());
return ret;
}

public CellPosition getStartPosition() {
return CellPosition.of(getRow1(), getCol1());
}
}
13 changes: 13 additions & 0 deletions nop-excel/src/main/java/io/nop/excel/model/ExcelImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@
import io.nop.excel.model._gen._ExcelImage;

public class ExcelImage extends _ExcelImage {
/**
* 嵌入图片的id
*/
private String embedId;

public ExcelImage() {

}

public String getEmbedId() {
return embedId;
}

public void setEmbedId(String embedId) {
this.embedId = embedId;
}
}
4 changes: 4 additions & 0 deletions nop-excel/src/main/java/io/nop/excel/model/IExcelSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import io.nop.core.model.table.ITableView;

import java.util.List;

public interface IExcelSheet {
String getName();

Expand All @@ -23,4 +25,6 @@ public interface IExcelSheet {
Double getDefaultColumnWidth();

ITableView getTable();

List<ExcelImage> getImages();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [152:18:0:0]/nop/schema/excel/workbook.xdef <p>
* generate from [156:18:0:0]/nop/schema/excel/workbook.xdef <p>
* 行区间的类型标注。例如标记表头,表旁,表尾等
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [126:22:0:0]/nop/schema/excel/workbook.xdef <p>
* generate from [130:22:0:0]/nop/schema/excel/workbook.xdef <p>
*
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [142:18:0:0]/nop/schema/excel/workbook.xdef <p>
* generate from [146:18:0:0]/nop/schema/excel/workbook.xdef <p>
* 当条件满足时,将对指定区间单元格的样式进行增量修改
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tell cpd to start ignoring code - CPD-OFF
/**
* generate from [165:18:0:0]/nop/schema/excel/workbook.xdef <p>
* generate from [169:18:0:0]/nop/schema/excel/workbook.xdef <p>
*
*/
@SuppressWarnings({"PMD.UselessOverridingMethod","PMD.UnusedLocalVariable",
Expand Down
Loading

0 comments on commit 2c46266

Please sign in to comment.