Skip to content

Commit

Permalink
Merge pull request #385 from meiMingle/feature_right_to_left
Browse files Browse the repository at this point in the history
Right to left Worksheet
  • Loading branch information
ochedru committed Jan 26, 2024
2 parents eeeb5fd + 54711b3 commit 2821a16
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ IntStream.rangeClosed(3,5).forEach(ws::hideRow);
IntStream.rangeClosed(3,5).forEach(ws::hideColumn);
```

Hide grid lines
```java
ws.hideGridLines();
```

Display the worksheet from right to left
```java
ws.rightToLeft();
```


Group rows or colums

```java
Expand Down
15 changes: 15 additions & 0 deletions fastexcel-writer/src/main/java/org/dhatim/fastexcel/Worksheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public class Worksheet implements Closeable {
* Whether grid lines are displayed
*/
private boolean showGridLines = true;

/**
* Display the worksheet from right to left
*/
private boolean rightToLeft = false;
/**
* Sheet view zoom percentage
*/
Expand Down Expand Up @@ -1017,6 +1022,9 @@ public void flush() throws IOException {
if (!showGridLines) {
writer.append(" showGridLines=\"false\"");
}
if (rightToLeft) {
writer.append(" rightToLeft=\"true\"");
}
if (zoomScale != 100) {
writer.append(" zoomScale=\"").append(zoomScale).append("\"");
}
Expand Down Expand Up @@ -1156,6 +1164,13 @@ public void hideGridLines() {
this.showGridLines = false;
}

/**
* Display the worksheet from right to left
*/
public void rightToLeft() {
this.rightToLeft = true;
}

/**
* Set sheet view zoom level in percent. Default is 100 (100%).
* @param zoomPercent - zoom level from 10 to 400
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,20 @@ void testForIssue261() throws Exception {
//}
}

@Test
void testForIssue63() throws Exception {
// try (FileOutputStream fileOutputStream = new FileOutputStream("D://right_to_left.xlsx")) {
byte[] bytes = writeWorkbook(wb -> {
Worksheet ws1 = wb.newWorksheet("Worksheet 1");
Worksheet ws2 = wb.newWorksheet("Worksheet 2");
ws1.rightToLeft();
ws1.value(0,0,"Hello");
ws1.value(0,1,"World");
});
// fileOutputStream.write(bytes);
// }
}

@Test
void testForIssue259() throws Exception {
//try (FileOutputStream fileOutputStream = new FileOutputStream("D://group_cols_test.xlsx")) {
Expand Down

0 comments on commit 2821a16

Please sign in to comment.