Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

适配新OpenXml,解决换行为多行的问题 #68

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/MiniWord/MiniWord.Implment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,16 +465,16 @@ private static void ReplaceText(OpenXmlElement xmlElement, WordprocessingDocumen
}
}
}

t.Text = EvaluateIfStatement(t.Text);

// add breakline
{
var newText = t.Text;
var splits = Regex.Split(newText, "(<[a-zA-Z/].*?>|\n)");
var splits = Regex.Split(newText, "(<[a-zA-Z/].*?>|\n|\r\n)").Where(o => o != "\n" && o != "\r\n");
var currentT = t;
var isFirst = true;
if (splits.Length > 1)
if (splits.Count() > 1)
{
foreach (var v in splits)
{
Expand Down
4 changes: 2 additions & 2 deletions src/MiniWord/MiniWord.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0;net5.0</TargetFrameworks>
<TargetFrameworks>net45;netstandard2.0;</TargetFrameworks>
<Version>0.7.1</Version>
</PropertyGroup>
<PropertyGroup>
Expand Down Expand Up @@ -32,6 +32,6 @@
<None Include="icon.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="2.18.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/MiniWord/MiniWordPicture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public string Extension
}
set { _extension = value; }
}
internal ImagePartType GetImagePartType
internal PartTypeInfo GetImagePartType
{
get
{
Expand Down
Loading