File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 304304 let m = circles . length ;
305305 let n = ( m > 0 ) ? circles [ 0 ] . length : 0 ;
306306 let result = "[\n" ;
307+ let excelResult = ""
307308 for ( let i = 0 ; i < m ; i ++ ) {
308309 result += " [" ;
309310 for ( let j = 0 ; j < n ; j ++ ) {
310311 let x = circles [ i ] [ j ] . x ;
311312 let y = circles [ i ] [ j ] . y ;
312313 let gray = getMeanGrayAt ( x , y , radius ) ;
313314 result += `${ gray } ${ j < n - 1 ? ", " : "" } ` ;
315+ excelResult += `${ gray } ${ j < n - 1 ? "\t" : "" } ` ;
314316 }
315317 result += `]${ i < m - 1 ? ",\n" : "" } ` ;
318+ excelResult += `${ i < m - 1 ? "\n" : "" } ` ;
316319 }
320+ navigator . clipboard . writeText ( excelResult ) . then ( ( ) => {
321+ alert ( 'Table copied to clipboard! Paste into Excel.' ) ;
322+ } ) . catch ( err => {
323+ console . error ( 'Failed to copy:' , err ) ;
324+ } ) ;
317325 result += "\n]" ;
318326 document . getElementById ( "grayOutput" ) . value = result ;
319327}
You can’t perform that action at this time.
0 commit comments