EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
261 stars 47 forks source link

dotnet 8.0 error #193

Closed TJMicroPower closed 5 months ago

TJMicroPower commented 5 months ago

dotnet 8.0,Call paragraph.AddImage(image, 160, 160);Error:Method not found: 'SixLabors.ImageSharp.Image SixLabors.ImageSharp.Image.Load(System.IO.Stream, SixLabors.ImageSharp.Formats.IImageFormat ByRef)'.

PrzemyslawKlys commented 5 months ago

Which version of SixLabors you have added? Please don't use anything higher than 2.1.6, as it wasn't tested and it's differently licensed (you need to pay for it).

TJMicroPower commented 5 months ago

Which version of SixLabors you have added? Please don't use anything higher than 2.1.6, as it wasn't tested and it's differently licensed (you need to pay for it). Thank you for your reply. The version of SixLabors is 2.1.3. It is automatically installed when installing the OfficeIMO package. Can you provide me with guidance on the problems I have encountered? Thank you. 微信图片_20240130095415

TJMicroPower commented 5 months ago

Which version of SixLabors you have added? Please don't use anything higher than 2.1.6, as it wasn't tested and it's differently licensed (you need to pay for it).

I carefully checked my project and understood what you meant. Installing OfficeIMO In Word's project, A, SixLabors ImageSharp is 2.1.3, but in Project B that references Project A, that is where the Word feature is actually used, the SixLabors ImageSharp is 3.1.2. I only used the function of inserting images into Word in one place in the project. I don't want to use this feature now. Is there a version that does not include SixLabors ImageSharp?

PrzemyslawKlys commented 5 months ago

You have 2 choices:

As final alternative:

TJMicroPower commented 5 months ago

You have 2 choices:

  • Downgrade SixLabors in your project to 2.1.3 or 2.1.6 (it's free)
  • Remove SixLabors completly from your project and just let OfficeIMO use what it uses. Don't upgrade.

As final alternative:

  • Stop using OfficeIMO - it uses 2.1.3 because it's free. Technically 3.xx of ImageSharp could also be used as a dependency and be free, but I don't want to risk it with futre license changes. Now the reason why we use ImageSharp is that we read some data from images to help inserting them properly. Could we do it differently - yes. Could we do it with another library - most likely. But so far the imagesharp is free and and I don't have a power to build something new.

Thank you very much for your prompt reply. Because my project is. net8.0, in the application of OfficeIMO, SixLabors ImageSharp will automatically become version 3.1.2 due to other dependencies. So, the first suggestion doesn't seem to work for me. For the second suggestion, I downloaded OfficeIMO and would like to remove SixLabors ImageSharp, but it caused a chain reaction that could not be achieved in reality. If I disable OfficeIMO, my complex Word layout would also be very painful to rewrite. If you could tell me: "Completely remove SixLabors from the project and let OfficeIMO use the content it uses. Do not upgrade",I will be very grateful. Anyway, thank you again!

PrzemyslawKlys commented 5 months ago

So if you try to downgrade 3.1.2 to 2.1.6 version does it not let you with net 8?

It may seem you have another project that requires 3.1.2, other than OfficeIMO. Can you provide a list of nugets you use?

In the end I can try to add support 3.1.2, and see what changes there are. Not sure if it's possible.

TJMicroPower commented 5 months ago

因此,如果您尝试将 3.1.2 降级到 2.1.6 版本,它不会让您使用 net 8 吗?

  • 3.1.2 仅支持 NET 6.0 及更高版本
  • 2.1.6 支持网络标准 2.1,所以据我所知应该与网络 8 兼容

除了 OfficeIMO 之外,您似乎还有另一个需要 3.1.2 的项目。你能提供你使用的 nuget 列表吗?

最后,我可以尝试添加对 3.1.2 的支持,看看有什么变化。不确定这是否可能。

Hello! As you said, 3.1.2 is a fee, and I have also checked and found that the cost is actually quite high. You don't need to spend time supporting 3.1.2. The error is as follows: I installed your library directly in the net8 project, and SixLabors installed version 3.1.2 directly. When it is explicitly stated in the project file that version 3.1.2 is version 2.1.3, it will prompt that the target of the low code framework I am using is dotnet8.0, and version reduction is not allowed. I can only follow your suggestion to deactivate OfficeIMO now. Testing to see if using Microsoft's DocumentFormat OpenXml implementation.You are really great. Thank you. If you have the opportunity to come to China, I will treat you to Chinese cuisine :)

PrzemyslawKlys commented 5 months ago

I just created net 8 project

image

image

image

image

So it clearly works. You can add nuget OfficeIMO to net 8 project without forcing 3.1.2.

TJMicroPower commented 5 months ago

Thank you for your reply. Unfortunately, the low code framework I am using uses SixLabors and is a higher version. It turns out that the reason is that lower versions cannot be used. 11130

TJMicroPower commented 5 months ago

I have contacted the author of walkingtec and he said that the version can be downgraded. In this way, my code was saved. Thank you! My phone number and WeChat number are 13821086888. I hope to stay in touch.

PrzemyslawKlys commented 5 months ago

Ye, so you're using WalkingTec.Mvvm.mvc which bumps imagesharp.

According to licensing of 3.1.2 if you're not using it directly but on dependency you can continue using it for free. One way to fix it is to check why OfficeIMO breaks on newer ImageSharp and just add support for both versions. But it's not my priority at the moment.

PrzemyslawKlys commented 5 months ago

Another issue you will have is with DocumentFormat which you use 3.0.1 - we use older version for now, and we don't yet support new one.

TJMicroPower commented 5 months ago

Okay, I understand. You are so kind and patient in answering my question. Thank you sincerely!