
Change Cells Alignment and Keep Existing Formattingįind Maximum Rows and Columns supported by XLS and XLSX formatsįor your information, there are different number of rows and columns supported by different MS Excel file formats.Please see the following article for more detail on this topic for your reference. It is most crucial statement.// Because if it will be false, no changes will take (true) // Apply style to range of (st, flag) // Save the workbook in XLSX format.wb.save(dirPath + "outputChangeCellsAlignmentAndKeepExistingFormatting.xlsx", SaveFormat.XLSX) Load sample Excel file containing cells with formatting.Workbook wb = new Workbook(dirPath + "sampleChangeCellsAlignmentAndKeepExistingFormatting.xlsx") // Access first worksheet.Worksheet ws = wb.getWorksheets().get(0) // Create cells range.Range rng = ws.getCells().createRange("B2:D7") // Create style object.Style st = wb.createStyle() // Set the horizontal and vertical alignment to center.st.setHorizontalAlignment(TextAlignmentType.CENTER) st.setVerticalAlignment(TextAlignmentType.CENTER) // Create style flag object.StyleFlag flag = new StyleFlag() // Set style flag alignments true. The following sample code loads the sample Excel file, creates the range and center aligns it horizontally and vertically and keeps the existing formatting intact. Please note, StyleFlag object is passed as a parameter to Range.applyStyle() method which actually applies the formatting to your desired range of cells. StyleFlag.Alignments property is provided by Aspose.Cells to achieve this functionality. It is quite often that we need to change the alignment of multiple cells but at the same time need to maintain the existing formatting as well. Change Cells Alignment and Keep Existing Formatting While you are downloading the latest build, here is a quick look at the most worth mentioning features in this release. Please check the release notes in order to get an idea about what is new and what has been fixed with this revision of Aspose.Cells for Android via Java. This release includes some new features, enhancements and other bug fixes that further improve the overall stability and usability of the API. For an easy access and utilization, Aspose.Cells for Android via Java APIs can be directly installed from Maven repository, see the document for your reference. We are pleased to announce the release of Aspose.Cells for Android via Java 18.9.
