Well, your code looks ok if not the best. Also, you may further refine the code segment as following:
e.g
Sample code:
Dim lastRow as Integer
Dim lastColumn as Integer
lastColumn = ws.Cells.MaxColumn
lastRow = ws.Cells.MaxRow
For lp = lastColumn to 0 step -1
If ws.Cells.IsColumnHidden(lp) = True
ws.Cells.DeleteColumn(lp)
End If
Next
For lp = lastRow to 0 step -1
If ws.Cells.IsRowHidden(lp) = True
ws.Cells.DeleteRow(lp)
End If
Next
If you still have any issue, kindly do provide your template Excel file, so we could evaluate your issue properly.
Regarding adding ListBox control to the form in VS.NET, you may refer to MSDN or browse internet to get plenty of helping materials for your complete reference. For example, the following docs may help you a bit:
“unused rows, columns” - do you mean blank rows or columns in the worksheet? If this is true, you may use try to use DeleteBlankRows and DeleteBlankColumns methods accordingly:
e.g
Sample code:
…
worksheet.Cells.DeleteBlankRows();
worksheet.Cells.DeleteBlankColumns();
Regarding removing your unwanted worksheets in the workbook, you may use WorksheetCollection.RemoveAt() attribute, see the document for your reference:
I'm using the below code to delete the unused sheets. I'm looping through all the sheets, but it is deleting only the 1st found unused sheet. Please let me know where i'm wrong.
Dim ws As Worksheet For Each ws In wb.Worksheets Dim sheetName As String = "" sheetName = ws.Name ws = wb.Worksheets(sheetName)
Thanks Amjad, Deleting unused sheets works fine, also i have coded to delete the hidden files.
I would like to do the same without aspose.cells.
I tried but no result.
Here's my code to delete unused excel sheets and hidden excel sheets without aspose.cells
Dim i As Integer = oWorkbook.Worksheets.Count - 1 Do Dim worksheet As Worksheet = oWorkbook.Worksheets(i) Dim mRows As Integer = worksheet.Rows.Count Dim mCols As Integer = worksheet.Columns.Count If mRows = 1 And mCols = 1 Then oWorkbook.Worksheets(i).Delete() End If 'delete hidden sheet If oWorkbook.Worksheets(i).Visible = False Then oWorkbook.Worksheets(i).Delete() 'wb.Worksheets(i).VisibilityType = VisibilityType.Visible End If i -= 1 Loop While i >= 0 oWorkbook.Save()
'delete hidden worksheet If oWorksheet.Visible = False Then oWorksheet.Delete() End If oWorkbook.Save()
Good to know that you have accomplished your desired task/ requirements via Aspose.Cells APIs.
And, I am afraid, these forums are specific to Aspose APIs, so we cannot help you much if you find any issue(s) using Office automation/ VSTO or any other component.
Should you have any query or issue with Aspose.Cells, feel free to contact us, we will be happy to assist you soon.
I would extend my application with Aspose.cells for .Net with converting Outlook emails to pdfs.
The search sould be done within the emails to check for attachments and if .msg files found, convert them also into pdf Inside a mail folder for each parent .msg files.
You will first use Aspose.Email component to convert MSG (emails) to MHTML file format and then use Aspose.Words component to convert the MHTML file to PDF file format.
For any confusion, issue or help regarding Aspose.Email Aspose.Words products, feel free to post into Aspose.Total forum here:
After an initial test, I observed the issue as you mentioned. I found the template Excel file that contains a WordArt text when converted to PDF file format, this text does not render at all.
e.g Sample code:
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(filePath); wb.Save(“out1.pdf”);
I have logged a ticket with an id “CELLSNET-43907” for your issue. We will look into it soon.
Once we have any update on it, we will let you know here.
This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
The issues you have found earlier (filed as CELLSNET-43907) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao