Thank you, onizet! You have made a great work.
I'm encountered this problem:
I have a .docx as template generated from Word2013.
In this template I have added 3 new style:
Result: the style "style_doc_2" is missing!
I've discovered that the problem is in the TryGetValueIgnoreCase in the OpenXmlDocumentStyleCollection class at line:
https://msdn.microsoft.com/en-us/library/system.stringcomparison%28v=vs.110%29.aspx:
I've modified that line in:
I'm encountered this problem:
I have a .docx as template generated from Word2013.
In this template I have added 3 new style:
- style_doc_1
- style_doc_2
-
style_doc_3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
</head>
<body>
<p class="style_doc_2">Hello world!!!</p>
</body>
</html>
Then I've used this line of code:var pars = converter.Parse(html)
with a delegate to HtmlStyles.StyleMissing.Result: the style "style_doc_2" is missing!
I've discovered that the problem is in the TryGetValueIgnoreCase in the OpenXmlDocumentStyleCollection class at line:
int rc = String.Compare(name, keys[mid], StringComparison.OrdinalIgnoreCase);
Microsoft says athttps://msdn.microsoft.com/en-us/library/system.stringcomparison%28v=vs.110%29.aspx:
An operation that uses word sort rules performs a culture-sensitive comparison wherein certain nonalphanumeric Unicode characters might have special weights assigned to them. Using word sort rules and the conventions of a specific culture, the hyphen ("-") might have a very small weight assigned to it so that "coop" and "co-op" appear next to each other in a sorted list.So the special character "_" (underscore) in "style_doc_2" is not considered in the comparison.
I've modified that line in:
int rc = String.Compare(name, keys[mid],System.Globalization.CultureInfo.CurrentCulture, System.Globalization.CompareOptions.IgnoreCase);
and everithing is fine.