Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active July 8, 2024 18:12
Show Gist options
  • Save aspose-com-kb/96c01e2256da043b33d750a30e939d4d to your computer and use it in GitHub Desktop.
Save aspose-com-kb/96c01e2256da043b33d750a30e939d4d to your computer and use it in GitHub Desktop.
Freeze Panes in Excel with Java. For further details: https://kb.aspose.com/cells/java/freeze-panes-in-excel-with-java/
import com.aspose.cells.*;
public class Main
{
public static void main(String[] args) throws Exception // Freeze panes in Excel
{
// Set the licenses
new License().setLicense("License.lic");
// Instantiate a new Workbook.
Workbook workbook = new Workbook("Sample.xlsx");
// Freezing panes at th cell G7
workbook.getWorksheets().get(0).freezePanes(6,6, 2, 3);
//workbook.getWorksheets().get(0).unFreezePanes();
// Saving the file
workbook.save("frozen.xlsx");
System.out.println("Rows and columns freezed successfully");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment