-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff842f4
commit 9ca29e8
Showing
43 changed files
with
869 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.nop.excel; | ||
|
||
import io.nop.api.core.config.IConfigReference; | ||
import io.nop.api.core.util.SourceLocation; | ||
|
||
import static io.nop.api.core.config.AppConfig.varRef; | ||
|
||
public interface ExcelConfigs { | ||
SourceLocation s_loc = SourceLocation.fromClass(ExcelConfigs.class); | ||
|
||
IConfigReference<Integer> CFG_EXCEL_MAX_SHEET_NAME_LENGTH = | ||
varRef(s_loc, "nop.excel.max-sheet-name-length", Integer.class, 31); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.nop.excel.model; | ||
|
||
import io.nop.core.model.table.ICellView; | ||
|
||
public interface IExcelCell extends ICellView { | ||
XptCellModel getModel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.nop.excel.model; | ||
|
||
import io.nop.core.model.table.IColumnConfig; | ||
|
||
public interface IExcelCol extends IColumnConfig { | ||
ExcelColumnConfig getColModel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.nop.excel.model; | ||
|
||
import io.nop.core.model.table.IRowView; | ||
|
||
public interface IExcelRow extends IRowView { | ||
XptRowModel getModel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.nop.excel.model; | ||
|
||
import io.nop.core.model.table.ITableView; | ||
|
||
public interface IExcelTable extends ITableView { | ||
IExcelRow getRow(int index); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
nop-ooxml/nop-ooxml-xlsx/src/main/java/io/nop/ooxml/xlsx/output/XlsxGenHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.nop.ooxml.xlsx.output; | ||
|
||
import io.nop.excel.model.ExcelWorkbook; | ||
|
||
import static io.nop.excel.ExcelConfigs.CFG_EXCEL_MAX_SHEET_NAME_LENGTH; | ||
|
||
public class XlsxGenHelper { | ||
/** | ||
* Excel中sheetName的长度不能超过31 | ||
*/ | ||
public static String normalizeSheetName(String sheetName, int index, ExcelWorkbook workbook) { | ||
int maxSheetNameLength = CFG_EXCEL_MAX_SHEET_NAME_LENGTH.get(); | ||
if (workbook.getModel() != null && workbook.getModel().getMaxSheetNameLength() != null && workbook.getModel().getMaxSheetNameLength() > 31) { | ||
maxSheetNameLength = workbook.getModel().getMaxSheetNameLength(); | ||
} | ||
|
||
if (sheetName.length() <= maxSheetNameLength) | ||
return sheetName; | ||
|
||
String postfix = "_" + (index + 1); | ||
return sheetName.substring(0, maxSheetNameLength - postfix.length()) + postfix; | ||
} | ||
|
||
} |
Oops, something went wrong.