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

fix bug:richtext export to excel font strikeout style missing #367

Merged
merged 1 commit into from
Apr 2, 2021
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
5 changes: 5 additions & 0 deletions ReoGrid/IO/ExcelReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,11 @@ private static void AddRunIntoRichText(Document doc, RichText rt, Run r)
foreColor = doc.ConvertFromCompColor(rpr.solidFill);
}

if (rpr.strike != null)
{
fontStyles |= Drawing.Text.FontStyles.Strikethrough;
}

if (rpr.b != null)
{
fontStyles |= Drawing.Text.FontStyles.Bold;
Expand Down
3 changes: 3 additions & 0 deletions ReoGrid/IO/ExcelSchame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,6 +1532,9 @@ public class RunProperty
[XmlElement("sz")]
public ElementValue<string> size;

[XmlElement("strike")]
public ElementValue<string> strike;

[XmlElement("b")]
public ElementValue<string> b;

Expand Down
5 changes: 5 additions & 0 deletions ReoGrid/IO/ExcelWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,11 @@ private static int AddSharedString(Document doc, Drawing.RichText rt)
//schema = "minor",
};

if ((r.FontStyles & Drawing.Text.FontStyles.Strikethrough) == Drawing.Text.FontStyles.Strikethrough)
{
rpr.strike = new ElementValue<string>();
}

if ((r.FontStyles & Drawing.Text.FontStyles.Bold) == Drawing.Text.FontStyles.Bold)
{
rpr.b = new ElementValue<string>();
Expand Down