From b18e573da4e007bab893edb8adf94219299eed4e Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Thu, 14 Nov 2024 22:44:22 +0300 Subject: [PATCH] AutoFit optimization --- RhSolutions.AddIn/Tools/OcrTool.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/RhSolutions.AddIn/Tools/OcrTool.cs b/RhSolutions.AddIn/Tools/OcrTool.cs index 96ec4ca..ae460ca 100644 --- a/RhSolutions.AddIn/Tools/OcrTool.cs +++ b/RhSolutions.AddIn/Tools/OcrTool.cs @@ -55,10 +55,18 @@ internal class OcrTool : ITool { Range excelCell = app.ActiveSheet.Cells(currentCell.Row + row, currentCell.Column + column); - excelCell.Value2 = table[row,column]; - excelCell.EntireColumn.AutoFit(); - excelCell.EntireRow.AutoFit(); + excelCell.Value2 = table[row, column]; } + + foreach (Range row in tableRange.Rows) + { + row.EntireRow.AutoFit(); + } + foreach (Range column in tableRange.Columns) + { + column.EntireColumn.AutoFit(); + } + app.ActiveSheet.Cells(currentCell.Row + rowCount + 1, currentCell.Column).Activate(); } }