How to Change Excel Row Height using C++

This easy tutorial will assist you on how to change Excel row height using C++. You will learn how following a few simple steps, adjust row height in excel using C++ in different ways like changing row height using a constant value or changing row height based on the data and style of content in that row. At the end after changing the height of the rows, the output file can be saved in XLSX or any other supported format.

Steps to Change Excel Row Height using C++

  1. Add the Aspose.Cells.Cpp library using the NuGet package manager to work with Excel file
  2. Include Aspose::Cells namespace in the beginning
  3. Instantiate the Workbook object by loading the target Excel file
  4. Access a worksheet where selected rows’ height is to change
  5. Change the row height by providing the row index and a fixed height value
  6. Select another worksheet where row height is to be changed with respect to the contents
  7. Change the multiple rows height based on data
  8. Save the workbook with the changed height of rows

These steps describe the process by sharing the necessary library and references to be included before setting row height in C++. After loading the target workbook, different worksheets are referenced whose rows’ heights are to be changed. Different functions are used to change the height based on the requirement that either the row height is to be changed by a fixed value or variable size is to be set considering the contents in the target row.

Code to Change Excel Row Height using C++

We use Factory::CreateIWorkbook() function to load the sample Excel file and then access its different worksheets by providing a sheet index. Each sheet has a collection of cells that supports a lot of functions including those to set individual row’s height. Also, the worksheet itself has a number of functions that can be used to set the height of the row in different ways based on the text style and size of the data.

Here you got the information to modify rows height in Excel using C++. You can perform a variety of conversions also like mentioned in the article How to Convert Excel to PDF using C++ that explains the conversion from an Excel file to a PDF file.

 English