Skip to content

Commit 2821a16

Browse files
authored
Merge pull request #385 from meiMingle/feature_right_to_left
Right to left Worksheet
2 parents eeeb5fd + 54711b3 commit 2821a16

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,17 @@ IntStream.rangeClosed(3,5).forEach(ws::hideRow);
230230
IntStream.rangeClosed(3,5).forEach(ws::hideColumn);
231231
```
232232

233+
Hide grid lines
234+
```java
235+
ws.hideGridLines();
236+
```
237+
238+
Display the worksheet from right to left
239+
```java
240+
ws.rightToLeft();
241+
```
242+
243+
233244
Group rows or colums
234245

235246
```java

fastexcel-writer/src/main/java/org/dhatim/fastexcel/Worksheet.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ public class Worksheet implements Closeable {
137137
* Whether grid lines are displayed
138138
*/
139139
private boolean showGridLines = true;
140+
141+
/**
142+
* Display the worksheet from right to left
143+
*/
144+
private boolean rightToLeft = false;
140145
/**
141146
* Sheet view zoom percentage
142147
*/
@@ -1017,6 +1022,9 @@ public void flush() throws IOException {
10171022
if (!showGridLines) {
10181023
writer.append(" showGridLines=\"false\"");
10191024
}
1025+
if (rightToLeft) {
1026+
writer.append(" rightToLeft=\"true\"");
1027+
}
10201028
if (zoomScale != 100) {
10211029
writer.append(" zoomScale=\"").append(zoomScale).append("\"");
10221030
}
@@ -1156,6 +1164,13 @@ public void hideGridLines() {
11561164
this.showGridLines = false;
11571165
}
11581166

1167+
/**
1168+
* Display the worksheet from right to left
1169+
*/
1170+
public void rightToLeft() {
1171+
this.rightToLeft = true;
1172+
}
1173+
11591174
/**
11601175
* Set sheet view zoom level in percent. Default is 100 (100%).
11611176
* @param zoomPercent - zoom level from 10 to 400

fastexcel-writer/src/test/java/org/dhatim/fastexcel/CorrectnessTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,20 @@ void testForIssue261() throws Exception {
539539
//}
540540
}
541541

542+
@Test
543+
void testForIssue63() throws Exception {
544+
// try (FileOutputStream fileOutputStream = new FileOutputStream("D://right_to_left.xlsx")) {
545+
byte[] bytes = writeWorkbook(wb -> {
546+
Worksheet ws1 = wb.newWorksheet("Worksheet 1");
547+
Worksheet ws2 = wb.newWorksheet("Worksheet 2");
548+
ws1.rightToLeft();
549+
ws1.value(0,0,"Hello");
550+
ws1.value(0,1,"World");
551+
});
552+
// fileOutputStream.write(bytes);
553+
// }
554+
}
555+
542556
@Test
543557
void testForIssue259() throws Exception {
544558
//try (FileOutputStream fileOutputStream = new FileOutputStream("D://group_cols_test.xlsx")) {

0 commit comments

Comments
 (0)