Skip to content

Commit d205245

Browse files
Merge pull request #1 from saqibmasood/master
Move Spreadsheet Editor into this repository
2 parents 5ba3f1f + ce48303 commit d205245

File tree

27 files changed

+2531
-0
lines changed

27 files changed

+2531
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target/
2+
*.lic
3+
*.xls*
4+
nb-configuration.xml
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2001-2014 Aspose Pty Ltd
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## HTML5 Spreadsheet Editor by Aspose.Cells for Java v1.6
2+
3+
Html5 Spreadsheet Editor is a web application that can view and edit spreadsheet documents in a web browser. It supports Excel, SpreadsheetML, CSV, OpenDocument and many other formats supported by Microsoft Excel. All basic features including cell editing, formatting, formula editing, row and column management etc. are supported.
4+
5+
![HTML5 Spreadsheet Editor](http://i.imgur.com/K79yltf.png)
6+
7+
HTML5 Spreadsheet Editor uses many features of [Aspose.Cells for Java](http://www.aspose.com/java/excel-component.aspx) and shows how to use them to create, manipulate and render a spreadsheet in your Java application.
8+
9+
### What's new
10+
11+
Read the [Release Notes](https://github.com/AsposeShowcase/Html5_Spreadsheet_Editor_by_Aspose.Cells_for_Java/releases/latest) for changes and new features and improvements in current version.
12+
13+
### Documentation
14+
15+
Detailed [documentation](http://www.aspose.com/docs/display/cellsjava/1.1.1+Introduction) for developers and end-users is available at our product documentation site.
16+
17+
### Getting Support and Contributing
18+
19+
Developers, who want to contribute, can send pull requests, report bugs and propose features. For more information, checkout our documenation for [contributors](http://www.aspose.com/docs/display/cellsjava/1.1.5+Contribute) and [getting support](http://www.aspose.com/docs/display/cellsjava/1.1.4+Support).
20+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.aspose.spreadsheeteditor;
2+
3+
import com.aspose.cells.CellsException;
4+
import com.aspose.cells.License;
5+
import java.io.IOException;
6+
import java.io.InputStream;
7+
import java.util.Date;
8+
import java.util.logging.Logger;
9+
10+
/**
11+
*
12+
* @author Saqib Masood
13+
*/
14+
public class AsposeLicense {
15+
16+
private static final Logger LOGGER = Logger.getLogger(AsposeLicense.class.getName());
17+
18+
public static final String FILE_NAME = "Aspose.Total.Java.lic";
19+
20+
private AsposeLicense() {
21+
}
22+
23+
public static void load() {
24+
Date expiry = License.getSubscriptionExpireDate();
25+
26+
if (expiry != null) {
27+
LOGGER.info(String.format("Aspose License is valid upto: %s", License.getSubscriptionExpireDate()));
28+
}
29+
}
30+
31+
static {
32+
try (InputStream i = AsposeLicense.class.getResourceAsStream(FILE_NAME)) {
33+
new License().setLicense(i);
34+
} catch (IOException x) {
35+
LOGGER.severe("Error occured while loading license");
36+
LOGGER.throwing(null, null, x);
37+
} catch (CellsException x) {
38+
LOGGER.severe("License error");
39+
LOGGER.throwing(null, null, x);
40+
}
41+
}
42+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
package com.aspose.spreadsheeteditor;
2+
3+
import java.io.Serializable;
4+
import java.util.HashSet;
5+
import java.util.StringJoiner;
6+
7+
public class Cell implements Serializable {
8+
9+
private String name;
10+
private String value;
11+
private String formula;
12+
private String style;
13+
private HashSet<String> cssClass = new HashSet<>(); //NOSONAR
14+
private int columnId;
15+
private int rowId;
16+
private int colspan = 0;
17+
private int rowspan = 0;
18+
private boolean bold;
19+
private boolean italic;
20+
private boolean underline;
21+
22+
public String getName() {
23+
return this.name;
24+
}
25+
26+
public Cell setName(String name) {
27+
this.name = name;
28+
return this;
29+
}
30+
31+
public Cell setValue(String value) {
32+
this.value = value;
33+
return this;
34+
}
35+
36+
public Cell setFormula(String formula) {
37+
this.formula = formula;
38+
return this;
39+
}
40+
41+
public String getValue() {
42+
return value;
43+
}
44+
45+
public String getFormula() {
46+
return formula;
47+
}
48+
49+
public String getStyle() {
50+
return style;
51+
}
52+
53+
public Cell addClass(String c) {
54+
this.cssClass.add(c);
55+
return this;
56+
}
57+
58+
public Cell removeClass(String c) {
59+
this.cssClass.remove(c);
60+
return this;
61+
}
62+
63+
public String getCssClass() {
64+
StringJoiner j = new StringJoiner(" ");
65+
for (String s : this.cssClass) {
66+
j.add(s);
67+
}
68+
return j.toString();
69+
}
70+
71+
public Cell setStyle(String style) {
72+
this.style = style;
73+
return this;
74+
}
75+
76+
public int getColumnId() {
77+
return columnId;
78+
}
79+
80+
public Cell setColumnId(int columnId) {
81+
this.columnId = columnId;
82+
return this;
83+
}
84+
85+
public int getRowId() {
86+
return rowId;
87+
}
88+
89+
public Cell setRowId(int rowId) {
90+
this.rowId = rowId;
91+
return this;
92+
}
93+
94+
public int getColspan() {
95+
return colspan;
96+
}
97+
98+
public Cell setColspan(int colspan) {
99+
this.colspan = colspan;
100+
return this;
101+
}
102+
103+
public int getRowspan() {
104+
return rowspan;
105+
}
106+
107+
public Cell setRowspan(int rowspan) {
108+
this.rowspan = rowspan;
109+
return this;
110+
}
111+
112+
public boolean isBold() {
113+
return bold;
114+
}
115+
116+
public Cell setBold(boolean bold) {
117+
this.bold = bold;
118+
return this;
119+
}
120+
121+
public boolean isItalic() {
122+
return italic;
123+
}
124+
125+
public Cell setItalic(boolean italic) {
126+
this.italic = italic;
127+
return this;
128+
}
129+
130+
public boolean isUnderline() {
131+
return underline;
132+
}
133+
134+
public Cell setUnderline(boolean underline) {
135+
this.underline = underline;
136+
return this;
137+
}
138+
139+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.aspose.spreadsheeteditor;
2+
3+
import javax.el.ValueExpression;
4+
import javax.faces.component.UIComponent;
5+
import javax.faces.context.FacesContext;
6+
import javax.faces.convert.Converter;
7+
import javax.faces.convert.FacesConverter;
8+
import javax.inject.Inject;
9+
10+
@FacesConverter("cellEditorConverter")
11+
public class CellConverter implements Converter {
12+
13+
@Inject
14+
private WorkbookService workbook;
15+
16+
@Inject
17+
private CellsService cells;
18+
19+
@Override
20+
public Object getAsObject(FacesContext context, UIComponent component, String value) {
21+
int columnId = (Integer) ((ValueExpression) component.getPassThroughAttributes().get("data-columnId")).getValue(context.getELContext());
22+
int rowId = (Integer) ((ValueExpression) component.getPassThroughAttributes().get("data-rowId")).getValue(context.getELContext());
23+
24+
Cell cell = cells.getCell(workbook.getCurrent(), columnId, rowId);
25+
if (value.trim().startsWith("=")) {
26+
cell.setFormula(value.trim());
27+
} else {
28+
cell.setValue(value);
29+
}
30+
31+
return cell;
32+
}
33+
34+
@Override
35+
public String getAsString(FacesContext context, UIComponent component, Object value) {
36+
Cell cell = (Cell) value;
37+
38+
if (cell.getFormula() != null) {
39+
return cell.getFormula();
40+
} else {
41+
return cell.getValue();
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)