Open-XML-SDK
Open-XML-SDK copied to clipboard
I am using the OpenXML SDK to read the PPT template for content replacement. After stress testing, I found that the memory usage is too high and the number of Gen0, Gen1, and Gen2 object collections is too frequent.
BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3880/23H2/2023Update/SunValley3) 11th Gen Intel Core i5-11400H 2.70GHz, 1 CPU, 12 logical and 6 physical cores .NET SDK 9.0.100-preview.3.24204.13 [Host] : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI .NET 8.0 : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job=.NET 8.0 Runtime=.NET 8.0
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|
| xxx | 2.293 s | 0.0110 s | 0.0103 s | 3000.0000 | 1000.0000 | 22.34 MB |
code
Read specific tags and modify content as shown in the following figure.