|
@@ -33,6 +33,11 @@ const SheetFFType = {
|
|
|
12 : '华文隶书',
|
|
|
}
|
|
|
|
|
|
+const HtObj = {
|
|
|
+ 0:"center",
|
|
|
+ 1:'left',
|
|
|
+ 2:'right'
|
|
|
+}
|
|
|
const setDefaultSource=(sourceText)=>{
|
|
|
return JSON.stringify({
|
|
|
isShow: true,
|
|
@@ -66,6 +71,16 @@ async function getTableData(){
|
|
|
|
|
|
getTableData()
|
|
|
|
|
|
+function handleCellStyle(cell){
|
|
|
+ return `
|
|
|
+ color: ${cell.fc};
|
|
|
+ font-weight: ${cell.bl ? 'bold' : 'normal'};
|
|
|
+ font-style: ${cell.it ? 'italic' : 'normal'};
|
|
|
+ text-align: ${HtObj[cell.HorizontalType]};
|
|
|
+ font-family: ${handleFF(cell.ff)};
|
|
|
+ `
|
|
|
+}
|
|
|
+
|
|
|
function handleFF(ff){
|
|
|
return ff ? (typeof ff == 'number' ? SheetFFType[ff] : ff) : ''
|
|
|
}
|
|
@@ -120,25 +135,17 @@ function getSizeStyle(index,type) {
|
|
|
:colspan="cell.mc.cs||1"
|
|
|
:rowspan="cell.mc.rs||1"
|
|
|
:style="`
|
|
|
- color: ${cell.fc};
|
|
|
- font-weight: ${cell.bl ? 'bold' : 'normal'};
|
|
|
- font-style: ${cell.it ? 'italic' : 'normal'};
|
|
|
background: ${cell.bg};
|
|
|
- font-size: ${cell.fs||info.Config?.FontSize||12}px;
|
|
|
- ${cell.ct.s ? '' : `font-family: ${handleFF(cell.ff)};`}
|
|
|
+ font-size: ${info.Config?.FontSize||cell.fs||12}px;
|
|
|
+ ${!cell.ct.s ? handleCellStyle(cell) : ''}
|
|
|
${getSizeStyle(cell_index,'width')}
|
|
|
`"
|
|
|
>
|
|
|
- <div class="split-word" v-if="cell.ct.s">
|
|
|
+ <div class="split-word" v-if="cell.ct.s" :style="`text-align: ${HtObj[cell.HorizontalType]};`">
|
|
|
<span
|
|
|
v-for="(word,word_index) in cell.ct.s"
|
|
|
:key="`${index}_${cell_index}_${word_index}`"
|
|
|
- :style="`
|
|
|
- color: ${word.fc};
|
|
|
- font-weight: ${word.bl ? 'bold' : 'normal'};
|
|
|
- font-style: ${word.it ? 'italic' : 'normal'};
|
|
|
- font-family: ${handleFF(word.ff)};
|
|
|
- `"
|
|
|
+ :style="handleCellStyle(word)"
|
|
|
>{{word.v}}</span>
|
|
|
</div>
|
|
|
<div v-else>{{cell.m}}</div>
|