Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
f71974c930
|
@ -14,4 +14,5 @@ This module contains articles about Apache POI.
|
||||||
- [Set Background Color of a Cell with Apache POI](https://www.baeldung.com/apache-poi-background-color)
|
- [Set Background Color of a Cell with Apache POI](https://www.baeldung.com/apache-poi-background-color)
|
||||||
- [Add Borders to Excel Cells With Apache POI](https://www.baeldung.com/apache-poi-add-borders)
|
- [Add Borders to Excel Cells With Apache POI](https://www.baeldung.com/apache-poi-add-borders)
|
||||||
- [Reading Values From Excel in Java](https://www.baeldung.com/java-read-dates-excel)
|
- [Reading Values From Excel in Java](https://www.baeldung.com/java-read-dates-excel)
|
||||||
|
- [Change Cell Font Style with Apache POI](https://www.baeldung.com/apache-poi-change-cell-font)
|
||||||
- More articles: [[next -->]](../apache-poi-2)
|
- More articles: [[next -->]](../apache-poi-2)
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.baeldung.poi.excel.cellstyle;
|
||||||
|
|
||||||
|
import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
|
import org.apache.poi.ss.usermodel.Font;
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
|
||||||
|
public class CellStyler {
|
||||||
|
public CellStyle createWarningColor(Workbook workbook) {
|
||||||
|
CellStyle style = workbook.createCellStyle();
|
||||||
|
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setFontName("Courier New");
|
||||||
|
font.setBold(true);
|
||||||
|
font.setUnderline(Font.U_SINGLE);
|
||||||
|
font.setColor(HSSFColorPredefined.DARK_RED.getIndex());
|
||||||
|
style.setFont(font);
|
||||||
|
|
||||||
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,52 @@
|
||||||
|
package com.baeldung.poi.excel.cellstyle;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class CellStylerUnitTest {
|
||||||
|
private static String FILE_NAME = "com/baeldung/poi/excel/cellstyle/CellStyle.xlsx";
|
||||||
|
private static final String NEW_FILE_NAME = "CellStyleTest_output.xlsx";
|
||||||
|
private String fileLocation;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setup() throws IOException, URISyntaxException {
|
||||||
|
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME)
|
||||||
|
.toURI())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testApplyWarningColor() throws IOException {
|
||||||
|
Workbook workbook = new XSSFWorkbook(fileLocation);
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
Row row1 = sheet.createRow(0);
|
||||||
|
row1.setHeightInPoints((short) 40);
|
||||||
|
|
||||||
|
CellStyler styler = new CellStyler();
|
||||||
|
CellStyle style = styler.createWarningColor(workbook);
|
||||||
|
|
||||||
|
Cell cell1 = row1.createCell(0);
|
||||||
|
cell1.setCellStyle(style);
|
||||||
|
cell1.setCellValue("Hello");
|
||||||
|
|
||||||
|
Cell cell2 = row1.createCell(1);
|
||||||
|
cell2.setCellStyle(style);
|
||||||
|
cell2.setCellValue("world!");
|
||||||
|
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(NEW_FILE_NAME);
|
||||||
|
workbook.write(outputStream);
|
||||||
|
outputStream.close();
|
||||||
|
workbook.close();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
- [Introduction to Lock Striping](https://www.baeldung.com/java-lock-stripping)
|
- [Introduction to Lock Striping](https://www.baeldung.com/java-lock-stripping)
|
||||||
- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue)
|
- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue)
|
||||||
|
- [Java Concurrent HashSet Equivalent to ConcurrentHashMap](https://www.baeldung.com/java-concurrent-hashset-concurrenthashmap)
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-concurrency-collections)
|
- [[<-- Prev]](/core-java-modules/core-java-concurrency-collections)
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
|
|
||||||
- [Java Naming and Directory Interface Overview](https://www.baeldung.com/jndi)
|
- [Java Naming and Directory Interface Overview](https://www.baeldung.com/jndi)
|
||||||
- [LDAP Authentication Using Pure Java](https://www.baeldung.com/java-ldap-auth)
|
- [LDAP Authentication Using Pure Java](https://www.baeldung.com/java-ldap-auth)
|
||||||
|
- [Testing LDAP Connections With Java](https://www.baeldung.com/java-test-ldap-connections)
|
||||||
|
|
|
@ -10,3 +10,4 @@ This module contains article about constructors in Java
|
||||||
- [Throwing Exceptions in Constructors](https://www.baeldung.com/java-constructors-exceptions)
|
- [Throwing Exceptions in Constructors](https://www.baeldung.com/java-constructors-exceptions)
|
||||||
- [Constructors in Java Abstract Classes](https://www.baeldung.com/java-abstract-classes-constructors)
|
- [Constructors in Java Abstract Classes](https://www.baeldung.com/java-abstract-classes-constructors)
|
||||||
- [Java Implicit Super Constructor is Undefined Error](https://www.baeldung.com/java-implicit-super-constructor-is-undefined-error)
|
- [Java Implicit Super Constructor is Undefined Error](https://www.baeldung.com/java-implicit-super-constructor-is-undefined-error)
|
||||||
|
- [Constructor Specification in Java](https://www.baeldung.com/java-constructor-specification)
|
||||||
|
|
|
@ -11,4 +11,5 @@ This module contains articles about core Java non-blocking input and output (IO)
|
||||||
- [How to Lock a File in Java](https://www.baeldung.com/java-lock-files)
|
- [How to Lock a File in Java](https://www.baeldung.com/java-lock-files)
|
||||||
- [Java NIO DatagramChannel](https://www.baeldung.com/java-nio-datagramchannel)
|
- [Java NIO DatagramChannel](https://www.baeldung.com/java-nio-datagramchannel)
|
||||||
- [Java – Path vs File](https://www.baeldung.com/java-path-vs-file)
|
- [Java – Path vs File](https://www.baeldung.com/java-path-vs-file)
|
||||||
|
- [What Is the Difference Between NIO and NIO.2?](https://www.baeldung.com/java-nio-vs-nio-2)
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-nio)
|
- [[<-- Prev]](/core-java-modules/core-java-nio)
|
||||||
|
|
|
@ -8,4 +8,6 @@ This module contains articles about core Java Security
|
||||||
- [Enabling Unlimited Strength Cryptography in Java](https://www.baeldung.com/jce-enable-unlimited-strength)
|
- [Enabling Unlimited Strength Cryptography in Java](https://www.baeldung.com/jce-enable-unlimited-strength)
|
||||||
- [Initialization Vector for Encryption](https://www.baeldung.com/java-encryption-iv)
|
- [Initialization Vector for Encryption](https://www.baeldung.com/java-encryption-iv)
|
||||||
- [HMAC in Java](https://www.baeldung.com/java-hmac)
|
- [HMAC in Java](https://www.baeldung.com/java-hmac)
|
||||||
|
- [Generating a Secure AES Key in Java](https://www.baeldung.com/java-secure-aes-key)
|
||||||
|
- [Computing an X509 Certificate’s Thumbprint in Java](https://www.baeldung.com/java-x509-certificate-thumbprint)
|
||||||
- More articles: [[<-- prev]](/core-java-modules/core-java-security-2)
|
- More articles: [[<-- prev]](/core-java-modules/core-java-security-2)
|
||||||
|
|
|
@ -6,3 +6,4 @@
|
||||||
- [Optimizing HashMap’s Performance](https://www.baeldung.com/java-hashmap-optimize-performance)
|
- [Optimizing HashMap’s Performance](https://www.baeldung.com/java-hashmap-optimize-performance)
|
||||||
- [Update the Value Associated With a Key in a HashMap](https://www.baeldung.com/java-hashmap-update-value-by-key)
|
- [Update the Value Associated With a Key in a HashMap](https://www.baeldung.com/java-hashmap-update-value-by-key)
|
||||||
- [Java Map – keySet() vs. entrySet() vs. values() Methods](https://www.baeldung.com/java-map-entries-methods)
|
- [Java Map – keySet() vs. entrySet() vs. values() Methods](https://www.baeldung.com/java-map-entries-methods)
|
||||||
|
- [Java IdentityHashMap Class and Its Use Cases](https://www.baeldung.com/java-identityhashmap)
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
This module contains articles about JavaFX.
|
This module contains articles about JavaFX.
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [Introduction to JavaFX](https://www.baeldung.com/javafx)
|
- [Introduction to JavaFX](https://www.baeldung.com/javafx)
|
||||||
- [Display Custom Items in JavaFX ListView](https://www.baeldung.com/javafx-listview-display-custom-items)
|
- [Display Custom Items in JavaFX ListView](https://www.baeldung.com/javafx-listview-display-custom-items)
|
||||||
|
- [Adding EventHandler to JavaFX Button](https://www.baeldung.com/javafx-button-eventhandler)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
## Spring Data JPA - Repositories
|
## Spring Data JPA - Repositories
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [Introduction to Spring Data JPA](https://www.baeldung.com/the-persistence-layer-with-spring-data-jpa)
|
- [Introduction to Spring Data JPA](https://www.baeldung.com/the-persistence-layer-with-spring-data-jpa)
|
||||||
- [Performance Difference Between save() and saveAll() in Spring Data](https://www.baeldung.com/spring-data-save-saveall)
|
- [Performance Difference Between save() and saveAll() in Spring Data](https://www.baeldung.com/spring-data-save-saveall)
|
||||||
- [LIKE Queries in Spring JPA Repositories](https://www.baeldung.com/spring-jpa-like-queries)
|
- [LIKE Queries in Spring JPA Repositories](https://www.baeldung.com/spring-jpa-like-queries)
|
||||||
|
- [How to Access EntityManager with Spring Data](https://www.baeldung.com/spring-data-entitymanager)
|
||||||
- More articles: [[<-- prev]](../spring-data-jpa-repo)
|
- More articles: [[<-- prev]](../spring-data-jpa-repo)
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
This module contains articles about Spring Cloud Gateway
|
This module contains articles about Spring Cloud Gateway
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
|
|
||||||
- [Exploring the new Spring Cloud Gateway](http://www.baeldung.com/spring-cloud-gateway)
|
- [Exploring the new Spring Cloud Gateway](http://www.baeldung.com/spring-cloud-gateway)
|
||||||
- [Writing Custom Spring Cloud Gateway Filters](https://www.baeldung.com/spring-cloud-custom-gateway-filters)
|
- [Writing Custom Spring Cloud Gateway Filters](https://www.baeldung.com/spring-cloud-custom-gateway-filters)
|
||||||
- [Spring Cloud Gateway Routing Predicate Factories](https://www.baeldung.com/spring-cloud-gateway-routing-predicate-factories)
|
- [Spring Cloud Gateway Routing Predicate Factories](https://www.baeldung.com/spring-cloud-gateway-routing-predicate-factories)
|
||||||
- [Spring Cloud Gateway WebFilter Factories](https://www.baeldung.com/spring-cloud-gateway-webfilter-factories)
|
- [Spring Cloud Gateway WebFilter Factories](https://www.baeldung.com/spring-cloud-gateway-webfilter-factories)
|
||||||
|
- [Using Spring Cloud Gateway with OAuth 2.0 Patterns](https://www.baeldung.com/spring-cloud-gateway-oauth2)
|
||||||
|
|
|
@ -2,12 +2,14 @@ package com.baeldung.springcloudgateway.customfilters.secondservice;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration;
|
||||||
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
||||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||||
|
|
||||||
import com.baeldung.springcloudgateway.customfilters.secondservice.web.SecondServiceRestController;
|
import com.baeldung.springcloudgateway.customfilters.secondservice.web.SecondServiceRestController;
|
||||||
|
|
||||||
@WebFluxTest(SecondServiceRestController.class)
|
@WebFluxTest(controllers = SecondServiceRestController.class,
|
||||||
|
excludeAutoConfiguration = ReactiveSecurityAutoConfiguration.class)
|
||||||
public class SecondServiceIntegrationTest {
|
public class SecondServiceIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -2,13 +2,15 @@ package com.baeldung.springcloudgateway.customfilters.service;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration;
|
||||||
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||||
|
|
||||||
import com.baeldung.springcloudgateway.customfilters.service.web.ServiceRestController;
|
import com.baeldung.springcloudgateway.customfilters.service.web.ServiceRestController;
|
||||||
|
|
||||||
@WebFluxTest(ServiceRestController.class)
|
@WebFluxTest(controllers = ServiceRestController.class,
|
||||||
|
excludeAutoConfiguration = ReactiveSecurityAutoConfiguration.class)
|
||||||
public class ServiceIntegrationTest {
|
public class ServiceIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
Loading…
Reference in New Issue