Skip to content
Open
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
9 changes: 5 additions & 4 deletions RtfPipe/Html/CssString.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using RtfPipe.Tokens;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

Expand Down Expand Up @@ -33,7 +34,7 @@ public CssString(IEnumerable<IToken> tokens, ElementType elementType, IEnumerabl
if (token is Font font)
Append(font);
else if (token is FontSize fontSize)
Append("font-size", fontSize.Value.ToPt().ToString("0.#") + "pt");
Append("font-size", fontSize.Value.ToPt().ToString("0.#", CultureInfo.InvariantCulture) + "pt");
else if (token is BackgroundColor background)
Append("background", "#" + background.Value);
else if (token is ParagraphBackgroundColor backgroundPara)
Expand Down Expand Up @@ -104,8 +105,8 @@ public CssString(IEnumerable<IToken> tokens, ElementType elementType, IEnumerabl
{
if (tokens.OfType<LineSpacingMultiple>().Any(m => m.Value == 1))
{
if ((Math.Abs(lineSpace.Value) / 240.0).ToString("0.#") != "1")
Append("line-height", (Math.Abs(lineSpace.Value) * DefaultBrowserLineHeight / 240.0).ToString("0.#"));
if ((Math.Abs(lineSpace.Value) / 240.0).ToString("0.#", CultureInfo.InvariantCulture) != "1")
Append("line-height", (Math.Abs(lineSpace.Value) * DefaultBrowserLineHeight / 240.0).ToString("0.#", CultureInfo.InvariantCulture));
}
else if (lineSpace.Value < 0)
{
Expand Down Expand Up @@ -496,7 +497,7 @@ public CssString Append(string property, params UnitValue[] values)
{
if (i > 0)
_builder.Append(' ');
var px = values[i].ToPx().ToString("0.#");
var px = values[i].ToPx().ToString("0.#", CultureInfo.InvariantCulture);
_builder.Append(px);
if (px != "0")
_builder.Append("px");
Expand Down
3 changes: 2 additions & 1 deletion RtfPipe/Html/HtmlVisitor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using RtfPipe.Tokens;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Xml;
Expand Down Expand Up @@ -532,7 +533,7 @@ private void WriteTabs(IEnumerable<IToken> parentStyles, bool newLine, int tabCo
{
var size = IndentSize(parentStyles, newLine, tabCount);
_writer.WriteStartElement("span");
_writer.WriteAttributeString("style", $"display:inline-block;width:{size.ToPx()}px");
_writer.WriteAttributeString("style", $"display:inline-block;width:{size.ToPx().ToString(CultureInfo.InvariantCulture)}px");
_writer.WriteEndElement();
}

Expand Down
2 changes: 1 addition & 1 deletion RtfPipe/RtfPipe.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net40;net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<NeutralLanguage>en-US</NeutralLanguage>
<Authors>Eric Domke</Authors>
<Company />
Expand Down