//判断表格居中 居中为true
        public bool detecttablecenter(DocumentFormat.OpenXml.Wordprocessing.Table table, string tbsJustification, WordprocessingDocument docx)
        {
            //居中检测
            TableProperties tpr = table.GetFirstChild <TableProperties>();

            if (tpr != null)
            {
                if (tpr.GetFirstChild <TableJustification>() != null)
                {
                    TableJustification tj = tpr.GetFirstChild <TableJustification>();
                    if (tj.Val.ToString() != tbsJustification && tj.Val.ToString() != null)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (tpr.TableStyle != null)
                    {
                        TableStyle style_id = tpr.TableStyle;
                        if (style_id != null)//从style中获取
                        {
                            string jc = Util.getFromStyle(docx, style_id.Val, 1);
                            if (jc != null && jc.ToString() != tbsJustification)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            return(true);
        }
        //判断是否为三线表 是为true
        protected bool correctTable(DocumentFormat.OpenXml.Wordprocessing.Table t)
        {
            int tcCount = 0;
            IEnumerable <TableRow> trList = t.Elements <TableRow>();
            int             rowCount      = trList.Count <TableRow>();
            TableProperties tpr           = t.GetFirstChild <TableProperties>();
            TableBorders    tb            = tpr.GetFirstChild <TableBorders>();

            if (tpr != null)
            {
                if (tb != null)
                {
                    if (rowCount <= 2)
                    {
                        return(true);
                    }
                    foreach (TableRow tr in trList)
                    {
                        tcCount++;
                        IEnumerable <TableCell> tcList = tr.Elements <TableCell>();
                        foreach (TableCell tc in tcList)
                        {
                            TableCellProperties tcp = tc.GetFirstChild <TableCellProperties>();
                            int bottom = 1;
                            if (tcp != null)
                            {
                                TableCellBorders tcb = tcp.GetFirstChild <TableCellBorders>();
                                if (tcb != null)
                                {
                                    if (tcb.GetFirstChild <LeftBorder>() != null)
                                    {
                                        if (tcb.GetFirstChild <LeftBorder>().Val != "nil")
                                        {
                                            return(false);
                                        }
                                    }
                                    if (tcb.GetFirstChild <RightBorder>() != null)
                                    {
                                        if (tcb.GetFirstChild <RightBorder>().Val != "nil")
                                        {
                                            return(false);
                                        }
                                    }
                                    //第一行
                                    if (tcCount == 1)
                                    {
                                        if (tcb.GetFirstChild <BottomBorder>() != null)
                                        {
                                            if (tcb.GetFirstChild <BottomBorder>().Val == "nil")
                                            {
                                                bottom = 0;
                                            }
                                        }
                                        else
                                        {
                                            if (tb.GetFirstChild <InsideHorizontalBorder>() != null)
                                            {
                                                if (tb.GetFirstChild <InsideHorizontalBorder>().Val == "none")
                                                {
                                                    return(false);
                                                }
                                            }
                                        }
                                        if (tcb.GetFirstChild <TopBorder>() != null)
                                        {
                                            if (tcb.GetFirstChild <TopBorder>().Val == "nil")
                                            {
                                                return(false);
                                            }
                                        }
                                        else
                                        {
                                            if (tb.GetFirstChild <TopBorder>() != null)
                                            {
                                                if (tb.GetFirstChild <TopBorder>().Val == "none")
                                                {
                                                    return(false);
                                                }
                                            }
                                        }
                                    }
                                    //第二行的top
                                    if (tcCount == 2)
                                    {
                                        if (tcb.GetFirstChild <TopBorder>() != null)
                                        {
                                            if (tcb.GetFirstChild <TopBorder>().Val == "nil" && bottom == 0)
                                            {
                                                return(false);
                                            }
                                        }
                                    }
                                    //除去第一行和最后一行的其他所有行
                                    if (tcCount != 1 && tcCount != rowCount)
                                    {
                                        if (tcb.GetFirstChild <BottomBorder>() != null)
                                        {
                                            if (tcb.GetFirstChild <BottomBorder>().Val == "single")
                                            {
                                                return(false);
                                            }
                                        }
                                        else
                                        {
                                            if (tcCount != 2 && tb.GetFirstChild <InsideHorizontalBorder>() != null && tb.GetFirstChild <InsideHorizontalBorder>().Val == "single")
                                            {
                                                return(false);
                                            }
                                        }
                                    }
                                    //最后一行并且不是第二行
                                    if (tcCount == rowCount && tcCount != 2)
                                    {
                                        if (tcb.GetFirstChild <TopBorder>() != null)
                                        {
                                            if (tcb.GetFirstChild <TopBorder>().Val == "single")
                                            {
                                                return(false);
                                            }
                                        }
                                        else
                                        {
                                            if (tb.GetFirstChild <InsideHorizontalBorder>() != null && tb.GetFirstChild <InsideHorizontalBorder>().Val == "single")
                                            {
                                                return(false);
                                            }
                                        }
                                        if (tcb.GetFirstChild <BottomBorder>() != null)
                                        {
                                            if (tcb.GetFirstChild <BottomBorder>().Val == "nil")
                                            {
                                                return(false);
                                            }
                                        }
                                        else
                                        {
                                            if (tb.GetFirstChild <BottomBorder>() != null)
                                            {
                                                if (tb.GetFirstChild <BottomBorder>().Val == "none")
                                                {
                                                    return(false);
                                                }
                                            }
                                        }
                                    }
                                }
                                //没有tcb的情况
                                else
                                {
                                    //第一行
                                    if (tcCount == 1)
                                    {
                                        if (tb.GetFirstChild <TopBorder>() != null)
                                        {
                                            if (tb.GetFirstChild <TopBorder>().Val == "none")
                                            {
                                                return(false);
                                            }
                                        }
                                        if (tb.GetFirstChild <InsideHorizontalBorder>() != null)
                                        {
                                            if (tb.GetFirstChild <InsideHorizontalBorder>().Val == "none")
                                            {
                                                return(false);
                                            }
                                        }
                                    }
                                    //中间行
                                    if (tcCount != 1 && tcCount != rowCount)
                                    {
                                        if (tcCount != 2 && tb.GetFirstChild <InsideHorizontalBorder>() != null && tb.GetFirstChild <InsideHorizontalBorder>().Val == "single")
                                        {
                                            return(false);
                                        }
                                    }
                                    //最后一行
                                    if (tcCount == rowCount && tcCount - 1 != rowCount)
                                    {
                                        if (tb.GetFirstChild <InsideHorizontalBorder>() != null && tb.GetFirstChild <InsideHorizontalBorder>().Val == "single")
                                        {
                                            return(false);
                                        }
                                        if (tb.GetFirstChild <BottomBorder>() != null)
                                        {
                                            if (tb.GetFirstChild <BottomBorder>().Val == "none")
                                            {
                                                return(false);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }