@@ -66,7 +66,7 @@ export default () => {
6666 reader . readAsText ( file )
6767 }
6868
69- const parseLineElement = ( el : Shape ) => {
69+ const parseLineElement = ( el : Shape , ratio : number ) => {
7070 let start : [ number , number ] = [ 0 , 0 ]
7171 let end : [ number , number ] = [ 0 , 0 ]
7272
@@ -90,7 +90,7 @@ export default () => {
9090 const data : PPTLineElement = {
9191 type : 'line' ,
9292 id : nanoid ( 10 ) ,
93- width : el . borderWidth || 1 ,
93+ width : + ( ( el . borderWidth || 1 ) * ratio ) . toFixed ( 2 ) ,
9494 left : el . left ,
9595 top : el . top ,
9696 start,
@@ -242,7 +242,7 @@ export default () => {
242242 lineHeight : 1 ,
243243 outline : {
244244 color : el . borderColor ,
245- width : el . borderWidth ,
245+ width : + ( el . borderWidth * ratio ) . toFixed ( 2 ) ,
246246 style : el . borderType ,
247247 } ,
248248 fill : el . fill . type === 'color' ? el . fill . value : '' ,
@@ -317,7 +317,7 @@ export default () => {
317317 }
318318 else if ( el . type === 'shape' ) {
319319 if ( el . shapType === 'line' || / C o n n e c t o r / . test ( el . shapType ) ) {
320- const lineElement = parseLineElement ( el )
320+ const lineElement = parseLineElement ( el , ratio )
321321 slide . elements . push ( lineElement )
322322 }
323323 else {
@@ -358,7 +358,7 @@ export default () => {
358358 rotate : el . rotate ,
359359 outline : {
360360 color : el . borderColor ,
361- width : el . borderWidth ,
361+ width : + ( el . borderWidth * ratio ) . toFixed ( 2 ) ,
362362 style : el . borderType ,
363363 } ,
364364 text : {
@@ -453,7 +453,21 @@ export default () => {
453453 data . push ( rowCells )
454454 }
455455
456- const colWidths : number [ ] = new Array ( col ) . fill ( 1 / col )
456+ const allWidth = el . colWidths . reduce ( ( a , b ) => a + b , 0 )
457+ const colWidths : number [ ] = el . colWidths . map ( item => item / allWidth )
458+
459+ const firstCell = el . data [ 0 ] [ 0 ]
460+ const border = firstCell . borders . top ||
461+ firstCell . borders . bottom ||
462+ el . borders . top ||
463+ el . borders . bottom ||
464+ firstCell . borders . left ||
465+ firstCell . borders . right ||
466+ el . borders . left ||
467+ el . borders . right
468+ const borderWidth = border ?. borderWidth || 0
469+ const borderStyle = border ?. borderType || 'solid'
470+ const borderColor = border ?. borderColor || '#eeece1'
457471
458472 slide . elements . push ( {
459473 type : 'table' ,
@@ -466,11 +480,11 @@ export default () => {
466480 rotate : 0 ,
467481 data,
468482 outline : {
469- width : el . borderWidth || 2 ,
470- style : el . borderType ,
471- color : el . borderColor || '#eeece1' ,
483+ width : + ( borderWidth * ratio || 2 ) . toFixed ( 2 ) ,
484+ style : borderStyle ,
485+ color : borderColor ,
472486 } ,
473- cellMinHeight : 36 ,
487+ cellMinHeight : el . rowHeights [ 0 ] ? el . rowHeights [ 0 ] * ratio : 36 ,
474488 } )
475489 }
476490 else if ( el . type === 'chart' ) {
0 commit comments