Browse Source

表格样式

Karsa 1 năm trước cách đây
mục cha
commit
368cfb9de2

+ 21 - 2
src/views/ppt/components/SheetWrap.vue

@@ -36,8 +36,27 @@ onMounted(()=>{
                     <td v-for="(col,colIndex) in row" 
                         :key="colIndex"
                         :rowspan="col.mc.rs===0?1:col.mc.rs"
-                        :colspan="col.mc.cs===0?1:col.mc.cs">
-                        <div>{{col.m}}</div>
+                        :colspan="col.mc.cs===0?1:col.mc.cs"
+                        :style="`
+                            color: ${col.fc};
+                            font-weight: ${col.bl ? 'bold' : 'normal'};
+                            font-style: ${col.it ? 'italic' : 'normal'};
+                            background: ${col.bg||'transparent'};
+                        `"
+                    >
+                        <!-- 单元格拆分 -->
+                        <div class="split-word" v-if="col.ct.s">
+                            <span 
+                                v-for="(word,word_index) in col.ct.s" 
+                                :key="`${rowIndex}_${colIndex}_${word_index}`"
+                                :style="`
+                                color: ${word.fc};
+                                font-weight: ${word.bl ? 'bold' : 'normal'};
+                                font-style: ${word.it ? 'italic' : 'normal'};
+                                `"
+                            >{{word.v}}</span>
+                        </div>
+                        <div v-else>{{col.m}}</div>
                     </td>
                 </tr>
             </tbody>

+ 5 - 1
src/views/ppt/hooks/usePPTPublish.js

@@ -359,7 +359,11 @@ function getTableData (data){
         const cell = row[j]
         let cellOptions = {
           colspan:cell.mc.cs===0?1:cell.mc.cs,
-          rowspan:cell.mc.rs===0?1:cell.mc.rs
+          rowspan:cell.mc.rs===0?1:cell.mc.rs,
+          color: cell.fc?cell.fc.substring(1):'333',
+          fill: cell.bg ? cell.bg.substring(1):'',
+          bold: cell.bl ? true : false,
+          italic: cell.it ? true : false,
         }
           _row.push({
             text:cell.m,