<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Exportar Excel e formatar células in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10771757#M52057</link>
    <description>&lt;P&gt;sorry for not translating into english&lt;/P&gt;&lt;P&gt;The image below shows how you are exporting today, and how I want to export.&lt;/P&gt;&lt;P&gt;I don't want to change the export mode, I just want to change the formatting of the cells in line 1 which would be the title by changing the color of the cells, and change the formatting of all cells from "Col3" to "text" to not become a date.&lt;/P&gt;&lt;P&gt;Here in Brazil we use the ";".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="edsaqueteAG5Q7_0-1637493024991.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/991996i41F3AC15F5A3D18A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="edsaqueteAG5Q7_0-1637493024991.png" alt="edsaqueteAG5Q7_0-1637493024991.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Nov 2021 11:10:39 GMT</pubDate>
    <dc:creator>edsaqueteAG5Q7</dc:creator>
    <dc:date>2021-11-21T11:10:39Z</dc:date>
    <item>
      <title>Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10769819#M52051</link>
      <description>&lt;P&gt;Preciso de ajuda, não estou conseguindo formatar a célula no excel para texto, assim alguns números não vira data, e caso seja possível alterar a cor das células da primeira linha.&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;(defun c:test ( / *error* arq A B C o)

    (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if arq (close arq))
    (princ))
  
  (setq narq (getfiled "Selecione o Nome e Local" "PLANILHA CTO" "csv" 1))
  
  (setq arq (open narq "w"))
  (write-line "Col1;Col2;Col3;Col4;Col5;Col6" arq )
  
  (setq A '(("0001" "aa" "01-01" "x001") ("0002" "aa" "002" "x002") )
	B '(("0001" "bb" "c01" "d002"))
	C A)
  
  (foreach i B
    (if (setq o (assoc (car i) A))
      (setq C (subst (append o (cdr i)) o C))))
  
  (foreach e C
    (write-line (apply 'strcat (mapcar '(lambda (x) (strcat x ";")) e)) &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;arq&lt;/STRONG&gt;&lt;/FONT&gt;))
  (if arq (close arq))
  (princ)))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 22:50:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10769819#M52051</guid>
      <dc:creator>edsaqueteAG5Q7</dc:creator>
      <dc:date>2021-11-19T22:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10770253#M52052</link>
      <description>&lt;P&gt;Import it the other way around.&lt;/P&gt;
&lt;P&gt;Run Excel, use Data / Import Txt/Csv ... then save it as *.xls.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 07:59:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10770253#M52052</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-11-20T07:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10770526#M52053</link>
      <description>Desculpa mais ainda estou aprendendo a programar, poderia me explicar mais detalhado.&lt;BR /&gt;&lt;BR /&gt;Obrigado</description>
      <pubDate>Sat, 20 Nov 2021 13:17:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10770526#M52053</guid>
      <dc:creator>edsaqueteAG5Q7</dc:creator>
      <dc:date>2021-11-20T13:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10770745#M52054</link>
      <description>&lt;P&gt;It really has nothing to do with programming experience. It's Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Z9E3zK5E_0-1637428089736.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/991907iD30AC99F7B2211E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Z9E3zK5E_0-1637428089736.png" alt="Z9E3zK5E_0-1637428089736.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 17:08:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10770745#M52054</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-11-20T17:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10771216#M52055</link>
      <description>&lt;P&gt;This forum is English based so post both, use Google Translate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"I'm sorry even more I'm learning to program, could you explain it to me more detailed."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also Double click in explorer csv file Excel will open file Automatically, or Start Excel File choose csv file&lt;/P&gt;&lt;P&gt;Google translate&lt;/P&gt;&lt;P&gt;Também clique duas vezes no arquivo do explorador csv O Excel abrirá o arquivo automaticamente ou o Arquivo Iniciar Excel escolherá o arquivo csv&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 03:17:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10771216#M52055</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2021-11-21T03:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10771351#M52056</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;this is an Example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to learn more, you should visit this site&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/office/vba/api/excel.shapes.addpicture" target="_blank"&gt;https://docs.microsoft.com/en-us/office/vba/api/excel.shapes.addpicture&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; (defun C:test (/ CLL COLM DATA EXCELAPP FILEPATH FOR HEADER_LIST INVISIBLE MASTERLIST MODE OR RANG ROW SHT SHTNUM SOURCERANGE SOURCEWBK TARGETSHT TARGETSHTS TARGETWBK WBK X)
  (vl-load-com)
 
    (setq FilePath (getfiled "Select Excel file to read :"
   (getvar "dwgprefix")
   "XLSX;XLS"
   16
       )
  )
  (setq ShtNum 1)
   
 
  (setq ExcelApp (vlax-get-or-create-object "Excel.Application"))
  (vla-put-visible ExcelApp :vlax-true)""or :vlax-false for invisible mode
  (setq Wbk (vl-catch-all-apply 'vla-open
       (list (vlax-get-property ExcelApp "WorkBooks") FilePath)))
  (setq Sht (vl-catch-all-apply 'vlax-get-property
          (list (vlax-get-property Wbk "Sheets")
         "Item" ShtNum)))
      (vlax-invoke-method Sht "Activate")
  (setq cll (vlax-get-property Sht "Cells"))

   (setq row 1
	 colm 1
	 )

   
   (setq header_list '("Col1""Col2""Col3""Col4""Col5""Col6")) 
   (repeat (length header_list)
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (car header_list))
       )
       
     
     (setq colm (1+ colm)
	   header_list
	    (cdr header_list)
	   )
     )
(setq Rang (vlax-get-property Sht "Range" "A1:f1"))
         (vlax-put-property (vlax-get-property Rang "Interior")
                          "Colorindex" (vlax-make-variant 4))
   (setq row 2
colm 1
)
  (setq MasterList '(("0001" "aa" "01-01" "x001") ("0002" "aa" "002" "x002") ))

   (repeat (length MasterList)
     (setq data (car MasterList))
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (car data))
       )
     (setq colm (1+ colm))
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (cadr data))
       )
     (setq colm (1+ colm))
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (caddr data))
       )
     (setq colm (1+ colm))
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (cadddr data))
       )
     (setq colm (1+ colm))
     
     
     (setq MasterList (cdr MasterList))
     (setq row	(1+ row)
	   colm 1
	   )
     )



    (vl-catch-all-apply
  'vlax-invoke-method
  (list Wbk "Close" :vlax-true)
  )

  
(vl-catch-all-apply
  'vlax-invoke-method
  (list ExcelApp "Quit")
  )



   (mapcar
  (function
    (lambda (x)
      (vl-catch-all-apply
 (function (lambda ()
      (progn
        (if (not (vlax-object-released-p x))
   (progn
     (vlax-release-object x)
     (setq x nil)
     )
   )
        )
      )
    )
 )
      )
    )
  (list  sourceRange TargetSht TargetWbk SourceWbk TargetShts TargetSht Sht Wbk ExcelApp)
  )
  (gc)
  (gc)
  (gc)
  (princ)
  
)



&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 440px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/991969i452B30CD1D7381E3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 07:11:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10771351#M52056</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2021-11-21T07:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10771757#M52057</link>
      <description>&lt;P&gt;sorry for not translating into english&lt;/P&gt;&lt;P&gt;The image below shows how you are exporting today, and how I want to export.&lt;/P&gt;&lt;P&gt;I don't want to change the export mode, I just want to change the formatting of the cells in line 1 which would be the title by changing the color of the cells, and change the formatting of all cells from "Col3" to "text" to not become a date.&lt;/P&gt;&lt;P&gt;Here in Brazil we use the ";".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="edsaqueteAG5Q7_0-1637493024991.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/991996i41F3AC15F5A3D18A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="edsaqueteAG5Q7_0-1637493024991.png" alt="edsaqueteAG5Q7_0-1637493024991.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Nov 2021 11:10:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10771757#M52057</guid>
      <dc:creator>edsaqueteAG5Q7</dc:creator>
      <dc:date>2021-11-21T11:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10772048#M52058</link>
      <description>&lt;P&gt;Add this is FOR every cell's&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;; Set text format :
   (vlax-put-property Cel "NumberFormat" (vlax-make-variant "@" 8))
   &lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 21 Nov 2021 16:13:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10772048#M52058</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2021-11-21T16:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10772164#M52059</link>
      <description>Friend would have to insert in the lisp that I sent the column formatting and change the line color in the range A1 to F1.</description>
      <pubDate>Sun, 21 Nov 2021 18:38:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10772164#M52059</guid>
      <dc:creator>edsaqueteAG5Q7</dc:creator>
      <dc:date>2021-11-21T18:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10772799#M52060</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; (defun C:test (/ CLL COLM DATA EXCELAPP FILEPATH FOR HEADER_LIST INVISIBLE MASTERLIST MODE OR RANG ROW SHT SHTNUM SOURCERANGE SOURCEWBK TARGETSHT TARGETSHTS TARGETWBK WBK X)
  (vl-load-com)
 
    (setq FilePath (getfiled "Select Excel file to read :"
   (getvar "dwgprefix")
   "XLSX;XLS"
   16
       )
  )
  (setq ShtNum 1)
   
 
  (setq ExcelApp (vlax-get-or-create-object "Excel.Application"))
  (vla-put-visible ExcelApp :vlax-true);;; or :vlax-false for invisible mode
  (setq Wbk (vl-catch-all-apply 'vla-open
       (list (vlax-get-property ExcelApp "WorkBooks") FilePath)))
  (setq Sht (vl-catch-all-apply 'vlax-get-property
          (list (vlax-get-property Wbk "Sheets")
         "Item" ShtNum)))
      (vlax-invoke-method Sht "Activate")
  (setq cll (vlax-get-property Sht "Cells"))

   (setq row 1
	 colm 1
	 )

   
   (setq header_list '("Col1""Col2""Col3""Col4""Col5""Col6")) 
   (repeat (length header_list)
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (car header_list))
       )
       
     
     (setq colm (1+ colm)
	   header_list
	    (cdr header_list)
	   )
     )
   
(setq Rang (vlax-get-property Sht "Range" "A1:f1"))
         (vlax-put-property (vlax-get-property Rang "Interior")
                          "Colorindex" (vlax-make-variant 4))
   (setq row 2
colm 1
)
  (setq MasterList '(("0001" "aa" "01-01" "x001") ("0002" "aa" "002" "x002") ))

   (repeat (length MasterList)
     (setq data (car MasterList))
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (car data))
       )
     (setq colm (1+ colm))
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (cadr data))
       )
     (setq colm (1+ colm))
    
       

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       (setq Cel (vlax-variant-value
      (vlax-get-property cll "Item"
        ;; row number :
        (vlax-make-variant row)
        ;; column number :
        (vlax-make-variant colm))))
   
 ;; Set text format :
   (vlax-put-property Cel "NumberFormat" (vlax-make-variant "@" 8))
   
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (caddr data))
       )
   
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  

   
     (setq colm (1+ colm))
     (vlax-put-property
       cll
       "Item"
       row
       colm
       (vl-princ-to-string (cadddr data))
       )
     (setq colm (1+ colm))
     
     
     (setq MasterList (cdr MasterList))
     (setq row	(1+ row)
	   colm 1
	   )
     );(repeat



    (vl-catch-all-apply
  'vlax-invoke-method
  (list Wbk "Close" :vlax-true)
  )

  
(vl-catch-all-apply
  'vlax-invoke-method
  (list ExcelApp "Quit")
  )



   (mapcar
  (function
    (lambda (x)
      (vl-catch-all-apply
 (function (lambda ()
      (progn
        (if (not (vlax-object-released-p x))
   (progn
     (vlax-release-object x)
     (setq x nil)
     )
   )
        )
      )
    )
 )
      )
    )
  (list  sourceRange TargetSht TargetWbk SourceWbk TargetShts TargetSht Sht Wbk ExcelApp)
  )
  (gc)
  (gc)
  (gc)
  (princ)
  
)



&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 418px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/992130i69B42CF88FEC17A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 06:13:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10772799#M52060</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2021-11-22T06:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10773534#M52061</link>
      <description>Your lisp is asking to open an existing excel file, I want to generate a new file as it was in my initial lisp, in my lisp it is already generating right, I would just like to add the cell formatting.</description>
      <pubDate>Mon, 22 Nov 2021 13:19:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10773534#M52061</guid>
      <dc:creator>edsaqueteAG5Q7</dc:creator>
      <dc:date>2021-11-22T13:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10776105#M52062</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;Try this it does not ask where to save the file&lt;BR /&gt;It saves it to the AutoCAD file location with the same name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;(defun C:test (/ CEL CLL COLM DATA DWGNAME EXCELAPP HEADER_LIST LEN MASTERLIST PDFNAME RANG ROW SHT SOURCERANGE SOURCEWBK TARGETSHT TARGETSHTS TARGETWBK WBK WBKAD X)
  (vl-load-com)
  
  
  (setq dwgname (GETVAR "dwgname"))
  (setq len (strlen dwgname))
  
  (setq dwgname (substr dwgname 1 (- len 4)))
  
  
  
  (setq pdfname (strcat (getvar "dwgprefix")  dwgname))
  (setq ExcelApp (vlax-get-or-create-object "Excel.Application"))
  (vla-put-visible ExcelApp :vlax-false)
  (setq Wbk (vlax-get-property ExcelApp "WorkBooks"))
  (setq WbkAD (vlax-invoke-method Wbk "add"))
  (setq Sht (vl-catch-all-apply 'vlax-get-property
	      (list (vlax-get-property WbkAD "Sheets")
		    "Item" 1)))
  (vlax-invoke-method Sht "Activate")
  (setq cll (vlax-get-property Sht "Cells"))
  
  (setq row 1
	colm 1
	)
  
  
  (setq header_list '("Col1""Col2""Col3""Col4""Col5""Col6"))
  (repeat (length header_list)
    (vlax-put-property
      cll
      "Item"
      row
      colm
      (vl-princ-to-string (car header_list))
      )
    
    
    (setq colm (1+ colm)
	  header_list
	   (cdr header_list)
	  )
    )
  
  (setq Rang (vlax-get-property Sht "Range" "A1:f1"))
  (vlax-put-property (vlax-get-property Rang "Interior")
    "Colorindex" (vlax-make-variant 4))
  (setq row 2
	colm 1
	)
  (setq MasterList '(("0001" "aa" "01-01" "x001") ("0002" "aa" "002" "x002") ))
  
  
  
  (repeat (length MasterList)
    (setq data (car MasterList))
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (setq Cel (vlax-variant-value
		(vlax-get-property cll "Item"
		  ;; row number :
		  (vlax-make-variant row)
		  ;; column number :
		  (vlax-make-variant colm))))
    
    ;; Set text format :
    (vlax-put-property Cel "NumberFormat" (vlax-make-variant "@" 8))
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    (vlax-put-property
      cll
      "Item"
      row
      colm
      (vl-princ-to-string (car data))
      )
    
    
    
    
    
    (setq colm (1+ colm))
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (setq Cel (vlax-variant-value
		(vlax-get-property cll "Item"
		  ;; row number :
		  (vlax-make-variant row)
		  ;; column number :
		  (vlax-make-variant colm))))
    
    ;; Set text format :
    (vlax-put-property Cel "NumberFormat" (vlax-make-variant "@" 8))
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    (vlax-put-property
      cll
      "Item"
      row
      colm
      (vl-princ-to-string (cadr data))
      )
    
    
    
    
    
    (setq colm (1+ colm))
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (setq Cel (vlax-variant-value
		(vlax-get-property cll "Item"
		  ;; row number :
		  (vlax-make-variant row)
		  ;; column number :
		  (vlax-make-variant colm))))
    
    ;; Set text format :
    (vlax-put-property Cel "NumberFormat" (vlax-make-variant "@" 8))
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    (vlax-put-property
      cll
      "Item"
      row
      colm
      (vl-princ-to-string (caddr data))
      )
    
    
    
    
    (setq colm (1+ colm))
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (setq Cel (vlax-variant-value
		(vlax-get-property cll "Item"
		  ;; row number :
		  (vlax-make-variant row)
		  ;; column number :
		  (vlax-make-variant colm))))
    
    ;; Set text format :
    (vlax-put-property Cel "NumberFormat" (vlax-make-variant "@" 8))
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    
    
    (vlax-put-property
      cll
      "Item"
      row
      colm
      (vl-princ-to-string (cadddr data))
      )
    
    
    
    
    
    
    
    (setq colm (1+ colm))
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (setq Cel (vlax-variant-value
		(vlax-get-property cll "Item"
		  ;; row number :
		  (vlax-make-variant row)
		  ;; column number :
		  (vlax-make-variant colm))))
    
    ;; Set text format :
    (vlax-put-property Cel "NumberFormat" (vlax-make-variant "@" 8))
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    
    
    (setq MasterList (cdr MasterList))
    (setq row	(1+ row)
	  colm 1
	  )
    
    
    
    );(repeat
  
  
  
  
  
  
  
  
  
  
  
  
  (vlax-invoke-method
    WbkAD
    "SaveAs"
    pdfname
    51
    nil
    nil
    :vlax-false
    :vlax-false
    1
    2
    )
  
  
  (vl-catch-all-apply
    'vlax-invoke-method
    (list WbkAD "Close" :vlax-true)
    )
  
  
  (vl-catch-all-apply
    'vlax-invoke-method
    (list ExcelApp "Quit")
    )
  
  
  
  (mapcar
    (function
      (lambda (x)
	(vl-catch-all-apply
	  (function (lambda ()
		      (progn
			(if (not (vlax-object-released-p x))
			  (progn
			    (vlax-release-object x)
			    (setq x nil)
			    )
			  )
			)
		      )
		    )
	  )
	)
      )
    (list  sourceRange TargetSht TargetWbk SourceWbk TargetShts TargetSht Sht Wbk ExcelApp)
    )
  (gc)
  (gc)
  (gc)
  (princ)
  
  )
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 23 Nov 2021 11:48:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10776105#M52062</guid>
      <dc:creator>hosneyalaa</dc:creator>
      <dc:date>2021-11-23T11:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Exportar Excel e formatar células</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10781604#M52063</link>
      <description>It's working, thank you</description>
      <pubDate>Thu, 25 Nov 2021 13:24:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/exportar-excel-e-formatar-celulas/m-p/10781604#M52063</guid>
      <dc:creator>edsaqueteAG5Q7</dc:creator>
      <dc:date>2021-11-25T13:24:42Z</dc:date>
    </item>
  </channel>
</rss>

