TCL: Write Data in table (XLS)

Source: Internet
Author: User

1 INTTOCHAR.TCL2 3 #input a number:1 to +, you'll get a char a to Z4 #a-z:1-325 proc Inttochar {int} {6     if{! [String isinteger $int]} {7         return "Please input a number!"8     } 9     if{! [Expr 0< $int &&32>$int]} {Ten         return "Input a numer range 1 to 32!" One     }  A set listchars [list A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] -Set intTemp [Expr $int-1] -     return[lindex $listChars $intTemp] the } -  - #Test - #return [Inttochar 1] +  -  + INTTOCHAR.TCL A  at Package require tcom - Source INTTOCHAR.TCL - proc Xls_write {fileName date} { - #if {[File exists $fileName]} { - #return {File is existed! Please delete or change the the the the file!} - #    } in     if{""==$date} { -         return "The date is NULL or '!" to     } + #set FileName {d:/test.xlsx} -     #Create a COM instance, open a worksheet theSet application [:: Tcom::ref CreateObject"Excel.Application"] *$application Visible 1 $ set workbooks [$application workbooks]Panax Notoginseng Set workbook [$workbooks Add] - set worksheets [$workbook worksheets] the     #set worksheet [$worksheets Item "Sheet1"] +set worksheet [$worksheets Item [Expr 1]] A set cells [$worksheet cells] the      +Set Exeflag 1 -      $     if{1==$exeFlag} { $ #set Date {} - set daterawlength [llength $date] - Set Rawindex 0 the          while{$rawIndex <$dateRawLength} { - Set Datecolumnlength 0Wuyi set datecolumnlength [llength [lindex $date $rawIndex]] the Set ColumnIndex 0 -              while{$columnIndex <$dateColumnLength} { Wu[$cells Item [Expr $rawIndex +1] [Inttochar [Expr $columnIndex +1]] Value2 [lindex [lindex $date $rawIndex] $columnIndex] - incr columnindex About             } $ incr Rawindex -         } -     }  -     #code not work like wanting A #if {[Regexp-all {\\|/} $fileName]} { + #CD [File DirName $fileName] the #    }  -     #Save without asking $ $application DisplayAlerts [expr 0] the #$workbook SaveCopyAs {d://ts.xlsx} the $workbook SaveAs $fileName the $workbook Close the $application Quit - #return [file join [File dirname $fileName] [file tail $fileName]] in } the #when a file with a path is saved, it sometimes fails for an unknown reason (xls default save path: Menu "File"--"options"-"save", view path) the set FileName {d:\testaaa.xlsx} AboutSet date [list [List 1 2 3 4 5 6 7 8 9 10] [List A b c D e F g] [list Nihao hello hello howareyou? ]] the #Test the return[Xls_write $fileName $date]

TCL: Write Data in table (XLS)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.