AutoFitMergedCellsType.EachLine is not working

@PramodHegde,

Thanks for the sample project and resource files.

I have logged it with your existing ticket “CELLSNET-50157” into our database. We will analyze your issue and try to figure it out soon.

@Amjad_Sahi: It says issue is resolved. What is the fix? How can I check ticket details?
CELLSNET-50157 ---- Status : Resolved

@PramodHegde,

We logged a ticket for the issue using our own test cases and fixed it. Now we will evaluate your test case with the fix and if it goes well, we will share the fix after performing other QA and incorporating other enhancements.

Thanks @Amjad_Sahi - Looking forward to see the fix.

@PramodHegde,

Sure, we will keep you posted on the fix.

@PramodHegde,
Please try the latest fix 21.12.6.
Aspose.Cells21.12.6 For .Net2_AuthenticodeSigned.Zip (5.6 MB)
Aspose.Cells21.12.6 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.12.6 For .NetStandard20.Zip (5.6 MB)

@simon.zhao: I have replaced the new dll and added reference, however getting below exception. Please check.
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly ‘System.Drawing.Common, Version=4.0.2.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. The system cannot find the file specified.
Source=Aspose.Cells
StackTrace:
at Aspose.Cells.WorkbookSettings…ctor(Workbook )
at Aspose.Cells.Workbook…ctor(FileFormatType fileFormatType)
at Aspose.Cells.Workbook…ctor()
at MergeSheetsFormat.Program.Main(String[] args) in C:\repos\MergeSheetsFormat\MergeSheetsFormat\Program.cs:line 17

@PramodHegde,

Please note, when using latest .NET Standard2.0 version/fix, some dependencies are required to work with v21.12.x. You may please add System.Drawing.Common library manually from the NuGet package manager to resolve the issue. Moreover, in some cases you may also require System.Text.Encoding API. You can get this information for .NET Standard by clicking on “Dependencies” node at the following link. See the details below:

@Amjad_Sahi i have used the same NuGet package which you have mentioned, now some different exception is coming. The exception is below-
System.ArgumentException
HResult=0x80070057
Message=‘IBM437’ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ‘name’)
Source=System.Private.CoreLib
StackTrace:
at System.Text.EncodingTable.InternalGetCodePageFromName(String name)
at System.Text.EncodingTable.GetCodePageFromName(String name)
at System.Text.Encoding.GetEncoding(String name)
at …ctor()
at ​ .(Stream )
at ​ .(Stream )
at .Stream )
at .(String , Stream , LoadOptions )
at Aspose.Cells.Workbook.(String, LoadOptions )
at Aspose.Cells.Workbook…ctor(String file)
at MergeSheetsFormat.Program.Main(String[] args) in
\Program.cs:line 22

@PramodHegde,

I did not ask you to use Aspose.Cells.Dll from Nuget package (link). I only told you to use System.Drawing.Common version should be >= 4.7.0 and System.Text.Encoding.CodePages version should be >= 4.7.0. In short, please try using the fix (@simon.zhao provided in his post here and import the above mentioned two libraries (System.Drawing.Common and System.Text.Encoding.CodePages)) into your project. Alternatively, you may remove existing Aspose.Cells references to your existing project and then import v21.12 from nuget repos. Now remove Aspose.Cells.Dll from the project and add reference to Aspose.Cells21.12.6 For .NetStandard20.

If you still find any issue, kindly create a separate (standalone) VS.NET project using Aspose.Cells21.12.6 For .NetStandard20 (fix) and the two libraries (System.Drawing.Common and System.Text.Encoding.CodePages) we mentioned above, zip the project and upload to some file sharing service (dropbox, Google drive, etc.). We will check it soon.

@Amjad_Sahi
With your fix its working, now what is happening all columns are of some fixed size which is also there in your Aspose.Cells 21.12.0.

@PramodHegde,

Could you elaborate on it and provide more details and samples if you think it is an issue.

When we use latest dll or nuget version “21.12.0”, we are facing a different issue which was reported and resolved earlier. Please check the issue which was reported earlier here - Autofit row height issue - Aspose.Cells Product Family - Free Support Forum - aspose.com

Please find the attached console app with latest dll or nuget version.AsposeTesting.zip (5.8 MB)

@PramodHegde,

I asked your to try latest fix (Aspose.Cells for .NET v21.12.6) instead of Aspose.Cells for .NET v21.12.0 (official release from Downloads section/Nuget repos.). It looks like Aspose.Cells for .NET v21.12.0 is still being used in your project. I did test your scenario/case using latest fix Aspose.Cells for .NET v21.12.6 (we shared earlier with you) and it works absolutely fine with it. See the attached output file on my end, The output file is fine tuned.
Output1.zip (14.5 KB)

We have tried different scenarios using the latest dll 21.12.6, but we got the below issues.

Point 1- With the below code---- Refer file- 1—we are getting ## instead of value – refer row- M316

Code

worksheet.AutoFitRows(new AutoFitterOptions
{
AutoFitMergedCellsType = AutoFitMergedCellsType.EachLine,
AutoFitWrappedTextType = AutoFitWrappedTextType.Paragraph,
MaxRowHeight = int.MaxValue,
OnlyAuto = true
});
worksheet.AutoFitColumns();

Point 2- With the below code---- Refer file- 2—issue mentioned in point 1 is getting resolved, however the autowrapping is not happening properly-- refer row- 274
Code

  worksheet.AutoFitRows(new AutoFitterOptions
                 {
                     AutoFitMergedCellsType = AutoFitMergedCellsType.EachLine,
                     AutoFitWrappedTextType = AutoFitWrappedTextType.Paragraph,
                     MaxRowHeight = int.MaxValue,
                     OnlyAuto = true

              });

            worksheet.AutoFitColumns(new AutoFitterOptions
            {
                AutoFitMergedCellsType = AutoFitMergedCellsType.EachLine,
                AutoFitWrappedTextType = AutoFitWrappedTextType.Paragraph,
                MaxRowHeight = int.MaxValue,
                OnlyAuto = true
            });

MergeSheetsFormat.zip (6.2 MB)

@PramodHegde,

Thanks for sharing your findings and samples.

We have recorded the samples with details against your issue"CELLSNET-50157" into our database. We will evaluate it thoroughly and get back to you soon.

Thanks @Amjad_Sahi: Please provide the fix details once you have it, as we are currently blocked.

@PramodHegde,

Sure, let us evaluate your issue thoroughly before we could update you on it.

1 Like

Can you please update on the issue? Any ETA by which we can expect fix?

@PramodHegde,

The issue is fixed and hopefully, we will provide the fixed version in the next few days.

Keep in touch.