We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with inline css , styles ignored in aspose word

  • facing the issue with aspose word , it is ignoring style applied to table td .
  • style width is not applied to the table td.

Below is html code , when tried to load it word document and save it aspose word ignoring the styles applied to the table tr td., e.g. width:100px applied to td.

<!DOCTYPE html>
        table {
          box-sizing: inherit;
          white-space: inherit;
          line-height: inherit;
          font-weight: inherit;
          font-size: inherit;
          color: inherit;
          font-style: inherit;
          text-align: inherit;
          font-variant: inherit;
          border-collapse: collapse;
          empty-cells: show;
          max-width: 100% !important;
          layout: fixed;

        table.fr-dashed-borders td,
        table.fr-dashed-borders th {
          border-style: dashed;

        table.fr-alternate-rows tr:nth-child(2n) {
          background: whitesmoke;

        table td,
        table th {
          border: 0px solid black;

        table td:empty,
        table th:empty {
          height: 20px;

        table td.fr-highlighted,
        table th.fr-highlighted {
          border: 1px double red;

        table td.fr-thick,
        table th.fr-thick {
          border-width: 2px;

        table th {
          background: #ececec;
          text-align: left;

        table td {
          word-wrap: initial;
          overflow: hidden;

        table.cp-border-all-cells td {
          border: 1px solid #000000 !important;
          padding: 5px;

        table.cp-border-all-cells th {
          border-bottom: 1px solid #000000 !important;

        table.cp-border-table {
          border: solid 2px #000000 !important;
        <table cellpadding=2 cellspacing=3 width="100%">
            <td style="width:15px;">&nbsp;&nbsp;</td>
            <td colspan="1">
              <p style="page-break-after:avoid;">
              <table class="cp-border-all-cells" style="width: 100%;">
                    <td colspan="2" style="vertical-align: top;">first default-asd as fdds fgh fg hfghfgh fghgfhfg f fghgf fgh fghfghf hfghfghasd as fdds fgh fg hfghfgh fghgfhfg f fghgf fgh fghfghf hfghfghasd as fdds fgh fg hfghfgh fghgfhfg f fghgf fgh fghfghf hfghfghasd as fdds fgh fg hfghfgh fghgfhfg f fghgf fgh fghfghf hfghfgh <br>
                    <td style="width: 100px !important; vertical-align: top;">LAbel Text</td>
                    <td style="vertical-align: top;">Random text</td>


The query is related to Aspose.Words, so we are moving it to the respective category where you will be assisted shortly.

@abdulkadirsabirbohari As I can see the table cell width is applied properly. But by default MS Word uses fit to content table auto fit behavior, so the width specified in one cell is not taken into account. If you open your document in MS Word you will see the same behavior: ms.docx (12.5 KB)

You can use the following code to fix the problem:

Document doc = new Document("C:\\Temp\\in.html");

foreach (Table t in doc.GetChildNodes(NodeType.Table, true))