TableLook.FirstColumn Not Working

Feb 19, 2014 at 6:53 AM
I am trying to customize the look of a table that is being exported to a word file. When I try to use TableLook.FirstColumn = false so that it doesn't bold the first column the exported file still has the firstcolumn checked.

Has anyone else experienced this issue or found a solution for this?

Thanks,
Josh
            Novacode.Table table = template.Tables[0];
            template.Tables[0].TableLook.FirstColumn = false;
            template.Tables[0].TableLook.FirstRow = false;
            table.Design = TableDesign.LightGridAccent1;
Feb 17, 2016 at 6:35 PM
I am noticing the same thing. I can't seem to remove that first column bold option.
Feb 17, 2016 at 9:42 PM
As always, once I comment, I end up solving it.
You can brute-force this just prior to .Save();
private void tweakIt(DocX document)
{
    XNamespace w = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
    var xml = document.Xml.Document;
    XElement body = xml.Root.Element(XName.Get("body", w.NamespaceName));

    // tables
    var tables = body.Elements(XName.Get("tbl", w.NamespaceName));
    foreach(var tbl in tables)
    {
        var tableProps = tbl.Element(XName.Get("tblPr", w.NamespaceName));
        if(tableProps != null)
        {
            var tLook = tableProps.Element(XName.Get("tblLook", w.NamespaceName));
            if(tLook != null)
            {
                var bmValue = tLook.Attribute(XName.Get("val", w.NamespaceName));
                if(bmValue != null)
                {
                    var mask = "0420";
                    bmValue.SetValue(mask);
                }
            }
        }
    }
}