Skip to content

Bugfix: Alignment setter assumes default left-alignment #299

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 3 additions & 12 deletions Xceed.Words.NET/Src/Paragraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,19 +595,10 @@ public Alignment Alignment
XElement pPr = GetOrCreate_pPr();
XElement jc = pPr.Element( XName.Get( "jc", DocX.w.NamespaceName ) );

if( alignment != Xceed.Words.NET.Alignment.left )
{
if( jc == null )
pPr.Add( new XElement( XName.Get( "jc", DocX.w.NamespaceName ), new XAttribute( XName.Get( "val", DocX.w.NamespaceName ), alignment.ToString() ) ) );
else
jc.Attribute( XName.Get( "val", DocX.w.NamespaceName ) ).Value = alignment.ToString();
}

if( jc == null )
pPr.Add( new XElement( XName.Get( "jc", DocX.w.NamespaceName ), new XAttribute( XName.Get( "val", DocX.w.NamespaceName ), alignment.ToString() ) ) );
else
{
if( jc != null )
jc.Remove();
}
jc.Attribute( XName.Get( "val", DocX.w.NamespaceName ) ).Value = alignment.ToString();
}
}

Expand Down