色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

如果列A單元格值為空或不為空,如何合并從電子表格(到HTML)提取的多個行值& # 39;不存在?

錢良釵1年前7瀏覽0評論

這是上傳的excel表格。

enter image description here

在運行我的代碼后,根據代碼,圖像的黑色是當前的輸出。藍色的勾號表示它工作良好,但是我想實現紅色的輸出。

enter image description here

.table{
    border:solid 1px;
    //width: 50mm;
    //height: 30mm;
    table-layout: fixed;
    border-collapse:collapse; //in table css, collapse is equivalent to cellspacing in table css and paddling is :enabled in td
    padding:0mm 0mm 0mm 0mm;
}

td {
    //border:solid 1px;
}

.itemname{
    //border:solid 1px;
    height: 10mm;
    width:  48mm;
    margin: 0mm;
    font-family: Helvetica, sans-serif;
    font-size:  3mm;
    line-height:    3mm;
    z-index:    1;
    padding-top:    0mm;
    padding-bottom: 0mm;
    padding-left:   1mm;
    padding-right:  1mm;
    text-align: center;
    vertical-align: top;
    overflow:   hidden;
    max-width:  100%;
    max-height: 100%;   
}

.price{
    //border: solid 1px;
    height: 8mm;
    width:  28mm;
    margin: 0mm;
    margin-right: 0mm;
    font-family:    Helvetica, sans-serif;
    font-size:  1.5em;
    font-weight:    600;
    padding-top:    0mm;
    padding-bottom: 0mm;
    padding-left:   0mm;
    padding-right: 1mm;
    text-align: right;
    vertical-align: top;
    overflow:   hidden;
    max-width:  100%;
    max-height: 100%;
}

.suppliers{
    //border:solid 1px;
    height: 5mm;
    width:  15mm;
    margin: 0mm;
    font-family:    times new roman;
    font-size:  2mm;
    line-height:    2mm;
    z-index:    1;  
    padding-top:    0mm;
    padding-bottom: 0mm;
    padding-left:   0mm;
    padding-right:  0mm;
    text-align: right;
    vertical-align: top;
    overflow:   hidden;
    max-width:  100%;
    max-height: 100%;    
}



  .pagebreak {
    page-break-inside:avoid;
}

<html>
    <head>
        <body>
            

<script>
    // Method to upload a valid excel file
function upload() {
  var files = document.getElementById('file_upload').files;
  if(files.length==0){
    alert("Please choose any file...");
    return;
  }
  var filename = files[0].name;
  var extension = filename.substring(filename.lastIndexOf(".")).toUpperCase();
  if (extension == '.XLS' || extension == '.XLSX') {
      //Here calling another method to read excel file into json
      excelFileToJSON(files[0]);
  }else{
      alert("Please select a valid excel file.");
  }
}

//Method to read excel file and convert it into JSON 

function excelFileToJSON(file){
    try {
      var reader = new FileReader();
      reader.readAsBinaryString(file);
      reader.onload = function(e) {

          var data = e.target.result;
          var workbook = XLSX.read(data, {
              type : 'binary'
          });
          var result = {};
          var firstSheetName = workbook.SheetNames[0];
          //reading only first sheet data
          var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[firstSheetName]);
          //displaying the json result into HTML table
          displayJsonToHtmlTable(jsonData);
          }
      }catch(e){
          console.error(e);
      }
}

//Method to display the data in HTML Table
function displayJsonToHtmlTable(jsonData){
  var table=document.getElementById("display_excel_data");
  if(jsonData.length>0){
      var htmlData=''
      
      for(var i=0;i<jsonData.length;i++){
        
          var row=jsonData[i];
          var itemname = row["Item Name"] || '';
          var price = row["Price"] || '';
          var suppliers = row["Suppliers"] || '';

          
          htmlData+='<table class="table">'
           +'<tr><td class="itemname" colspan=3>'+itemname+'</td></tr>'
           +'<td class="price">'+price+'&nbsp;</td></tr>'
           +'<td class="price">'+suppliers+'&nbsp;</td></tr>'
           +'</table>';
      }
      table.innerHTML=htmlData;
      
  }else{
      table.innerHTML='There is no data in Excel';
  }
}
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.5/xlsx.min.js"></script>  

 

<h1>Upload an excel file to display in HTML Table</h1>
<!-- Input element to upload an excel file -->
<input type="file" id="file_upload" />
<button onclick="upload()">Upload</button>  
<br>
<br>
<!-- table to display the excel data -->

<p style="page-break-after: always;">&nbsp;</p>

<div id="display_excel_data"></div>


</body>
</head>
</html>