Skip to content

Right to left Worksheet #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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