protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
814 stars 416 forks source link

xlsx-style cell merged areas border #149

Open mithilesh786822 opened 3 years ago

mithilesh786822 commented 3 years ago

Merged cell border not working with json

RimaCiklum commented 3 years ago

Could you please leave some code snippet?

mithilesh786822 commented 3 years ago

var exportArr=[];

    exportArr.push(
      [

{ "merge": { "c": 0, "r":1,

          },
          "style": {
            "font": {
              "bold": "600"
            },

"width":100,

          },

          "text": "Details"
      },

{ "merge": { "c": 0, "r":1 }, "style": { "font": { "bold": true }, "width":100, },

          "text": "Master Details"
      },

      {
          "merge": {
              "c": 3,

"r":0 }, "style": { "font": { "bold": true, "name": 'Comic Sans MS', "underline": true, "sz": "12", "color":{ rgb: "ffffff" }, }, "alignment":{ "vertical": "center", "horizontal": "center" },

"border":{ "top":{style:"medium"}, "bottom":{style:"medium"}, "left":{style:"medium"}, "right":{style:"medium"} }, "fill": { "fgColor": { rgb: "007acc" }, }, }, "text": "DT Master Details" },

],);

On Fri, Aug 7, 2020 at 2:57 PM RidaMaryam notifications@github.com wrote:

Could you please leave some code snippet?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/protobi/js-xlsx/issues/149#issuecomment-670425053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQA3XIJ2E46CVWLB3JS53WTR7PCJDANCNFSM4PUJ6KIQ .

RimaCiklum commented 3 years ago

From the code above the first thing that I notice is the object structure. Haven't tried the object structure you provided above myself. If this (picture attached) is what you want then the following object structure might be helpful.

workbook = {
  "SheetNames": [
    "Main"
  ],
  "Sheets": {
    "Main": {
      "!merges": [
        {
          "s": {
            "c": 0,
            "r": 0
          },
          "e": {
            "c": 2,
            "r": 0
          }
        }
      ],
      "A1": {
        "v": "This is a submerged cell",
        "s": {
          "border": {
            "left": {
              "style": "thick",
              "color": {
                "auto": 1
              }
            },
            "top": {
              "style": "thick",
              "color": {
                "auto": 1
              }
            },
            "bottom": {
              "style": "thick",
              "color": {
                "auto": 1
              }
            }
          }
        },
        "t": "s"
      },
      "B1": {
        "v": "Pirate ship",
        "s": {
          "border": {
            "top": {
              "style": "thick",
              "color": {
                "auto": 1
              }
            },
            "bottom": {
              "style": "thick",
              "color": {
                "auto": 1
              }
            }
          }
        },
        "t": "s"
      }
    }
  }
}

image

mithilesh786822 commented 3 years ago

From the this site url : https://www.jqueryscript.net/demo/JavaScript-JSON-Data-Excel-XLSX/

using the generate export to excel but merge cell or row than border not working property.

On Fri, Aug 7, 2020 at 4:00 PM RidaMaryam notifications@github.com wrote:

From the code above the first thing that I notice is the object structure. Haven't tried the object structure you provided above myself. If this (picture attached) is what you want then the following object structure might be helpful. workbook = { "SheetNames": [ "Main" ], "Sheets": { "Main": { "!merges": [ { "s": { "c": 0, "r": 0 }, "e": { "c": 2, "r": 0 } } ], "A1": { "v": "This is a submerged cell", "s": { "border": { "left": { "style": "thick", "color": { "auto": 1 } }, "top": { "style": "thick", "color": { "auto": 1 } }, "bottom": { "style": "thick", "color": { "auto": 1 } } } }, "t": "s" }, "B1": { "v": "Pirate ship", "s": { "border": { "top": { "style": "thick", "color": { "auto": 1 } }, "bottom": { "style": "thick", "color": { "auto": 1 } } } }, "t": "s" } } } }

[image: image] https://user-images.githubusercontent.com/52397892/89636782-9ac3ce00-d8c2-11ea-962d-e4a5f315cd2a.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/protobi/js-xlsx/issues/149#issuecomment-670450112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQA3XIPIDZNCAYC43I23OHTR7PJVFANCNFSM4PUJ6KIQ .