Assuming you are not adverse to using VBA in your spreadsheet, this is possible. First, if you do not already have the Developer tab on your Ribbon, go to File->Options, Customize Ribbon, and in the right-hand panel check on Developer then hit OK. Next, click the Developer tab, then Visual Basic. On the left-hand side, double-click This Workbook and paste the code below. Alter the Configuration as necessary. Now whenever you click to save your workbook, the rows will automatically adjust to the specified parameters.
It's worth noting the possibility of more than 31 rows fit on the page, despite the calculation otherwise; using Excel's Normal margins and header/footer, 34 rows fit on a page. Changing the margins and header/footer to 0, 31 rows fit on the page.
For that reason, I suggest double checking with Print Preview, and decreasing RowsPerPage accordingly if you do have more rows than expected per page. There is only so much resolution for actually setting Row Heights, so unfortunately it's not perfect. Hope it helps, anyway.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
RowsPerPage = 31 ' number of rows per page, as stated in question
NumberOfPages = 1 ' how many pages of data you have
NumberOfSheets = 1 ' How many spreadsheets are in use
TargetPageHeight = 29.7 ' A4 height in cm
' Don't change anything below here
TargetPageHeight = Application.CentimetersToPoints(TargetPageHeight)
TotalRowCount = NumberOfPages * RowsPerPage + 1 'Resize beyond the specified area so a smaller row doesn't sneak in
For sheetIndex = 1 To NumberOfSheets
AvailablePageHeight = TargetPageHeight
AvailablePageHeight = AvailablePageHeight - (.TopMargin + .BottomMargin + .HeaderMargin + .FooterMargin)
OptimalRowHeight = AvailablePageHeight / RowsPerPage
currentIndex = 1
While currentIndex <= TotalRowCount
Rows(currentIndex).RowHeight = OptimalRowHeight
currentIndex = currentIndex + 1