Tag Archives: object

ForEach loop object required error

Questions: Summary: I have a list of policy numbers I’m looping through in Column A using the for each loop Problem: Everything works except if there is an empty cell in Column A, my code deletes the entire row (as it should), but then when I try to set the policy variable I get a… Read More »

Django: export object from database to excel

Questions: i have this in my template : <table> <tr><td>book_id</td><td>book name</td><td>book_author</td></tr> {% for book in books %} <tr><td>{{ book.book_id }}</td><td>{{ book.book_name }}</td><td>{{ book.book_author }}</td></tr> {% endfor %} </table> <a href=”/export”>Export to Excel !</a> my view seems to be like this: def export_excel(request): books = Book.objects.all() response = HttpResponse(books , content_type=’application/vnd.ms-excel;charset=utf-8′) response[‘Content-Disposition’] = ‘attachment; filename=”books.xls”‘ return… Read More »

Excel Interop Objects not being released

Questions: I am using the below methods. After this code block executes, I find that Microsoft Excel is still running in the background via checking Task Manager. Edit: Exactly one Microsoft Excel background process remains live. I am just adding this because when I first began working with Excel and Interop COM objects, sometimes many… Read More »

Clean up Excel Interop Objects with IDisposable

Questions: In my company the common way to release Excel Interop Objects is to use IDisposable the following way: Public Sub Dispose() Implements IDisposable.Dispose If Not bolDisposed Then Finalize() System.GC.SuppressFinalize(Me) End If End Sub Protected Overrides Sub Finalize() _xlApp = Nothing bolDisposed = True MyBase.Finalize() End Sub where _xlApp was created in the constructor the… Read More »