excel

How to create a RichTextString using Apache POI framework in Java?

狂风中的少年 提交于 2021-02-10 18:44:53
问题 How to create a RichTextString for Microsoft Excel, using Apache POI framework in Java SE? 回答1: From here and here for HSSF and XSSF: HSSFCell hssfCell = row.createCell(idx); //rich text consists of two runs HSSFRichTextString richString = new HSSFRichTextString( "Hello, World!" ); richString.applyFont( 0, 6, font1 ); richString.applyFont( 6, 13, font2 ); hssfCell.setCellValue( richString ); XSSFRichTextString s1 = new XSSFRichTextString("Apache POI"); s1.applyFont(boldArial); cell1

How to keep the Row Height constant when a table is pushed down on the sheet

五迷三道 提交于 2021-02-10 18:41:51
问题 I have a sheet with 2 tables. Each table has a header that I want to be a height of 30 while all table rows are the standard 15. When I add a row to the top table, the bottom table gets pushed down. The header Height on the bottom table picks up the height of the new spreadsheet row. Is there a way to make the bottom table keep its header height at 30? Here is my code to add rows to the top table. Set tblAssemblies = Worksheets("Summary").ListObjects("Table1") Count = 1 Do tblAssemblies

Copying Data From Word Document Using Excel VBA

白昼怎懂夜的黑 提交于 2021-02-10 18:40:59
问题 I have an excel file that that has a filename of a word document. I want to use excel vba to open the word document, then search for a specific phrase, copy the characters following that phrase, and paste it back into the original excel file. I have attempted several ways to implement this design, with little success. Below is my most recent attempt. My main issue is that the program usually just stops when it hits my with statement. Why does that happen, and how do I fix things so that the

Using a wildcard in a sumproduct in excel

与世无争的帅哥 提交于 2021-02-10 18:36:29
问题 I'm trying to find a way to use sumproduct in excel but for only the records that begin with a certain character string. Basic sumproduct =SUMPRODUCT(BC:BC,BD:BD)/SUM(BC:BC) Is there any way to make each range dependent upon a search criteria? So let's say, only use records in BC:BC & BD:BD that have a corresponding record in BA:BA that begins with Stack. I don't think you can use wildcards in sumproduct but is there another function I could be using? Thanks. 回答1: You CAN do this using

Simple Histogram in VBA?

牧云@^-^@ 提交于 2021-02-10 18:36:18
问题 I have data stored in some column (Say, Column A). The length of Column A is not fixed (depends on previous steps in the code). I need a histogram for the values in Column A, and have it in the same sheet. I need to take the values in column A, and automatically compute M Bins, then give the plot. I looked online for a "simple" code, but all codes are really fancy, with tons of details that I don't need, to the extent that I am not even able to use it. (I am a VBA beginner.) I found the

Using a wildcard in a sumproduct in excel

孤人 提交于 2021-02-10 18:30:33
问题 I'm trying to find a way to use sumproduct in excel but for only the records that begin with a certain character string. Basic sumproduct =SUMPRODUCT(BC:BC,BD:BD)/SUM(BC:BC) Is there any way to make each range dependent upon a search criteria? So let's say, only use records in BC:BC & BD:BD that have a corresponding record in BA:BA that begins with Stack. I don't think you can use wildcards in sumproduct but is there another function I could be using? Thanks. 回答1: You CAN do this using

Search for an element in the VBA ArrayList

爷,独闯天下 提交于 2021-02-10 18:23:56
问题 I hope you are great! I want to search through a VBA ArrayList and get the index number, the problem is, with For loop, you can only get the exact matches' index. I have the most of my search element (highlighted in the red box) and I want to get the elements which highlighted in the blue box, is there any way to do this in VBA? 回答1: You can use the in-built function InStr to find an occurrence of one string inside another. In your case change this: If list(j) = search_element Then To: If

Excel Datetime SN Conversion in Python

Deadly 提交于 2021-02-10 18:20:37
问题 My csv input file sometimes has excel serial numbers in the date field. I am using the following code as my input file should never contain dates prior to 01/2000. However, this solution is quite time consuming and I am hoping to find a better solution. Thank you. def DateCorrection(x): if pd.to_datetime(x) < pd.to_datetime('2000-01-01'): return pd.to_datetime(datetime.fromordinal(datetime(1900, 1, 1).toordinal() + int(x) - 2)) else: return pd.to_datetime(x) 回答1: Assuming your input looks

Error opening Excel (XLSX) files from pandas xlsxwriter

六眼飞鱼酱① 提交于 2021-02-10 18:12:00
问题 Upon opening an XLSX file in MS Excel, an error dialog is presented: "We found a problem with some content in filename.xlsx ..." Clicking "Yes" to attempt recovery yields the following XML error message: <?xml version="1.0" encoding="UTF-8" standalone="true"?> -<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <logFileName>error359720_09.xml</logFileName> <summary>Errors were detected in file 'C:\Users\username\Github\Project\Data\20200420b.xlsx'</summary> -

Outloook VBA macro to reply all with oft template

与世无争的帅哥 提交于 2021-02-10 18:00:38
问题 I have a macro built for VBA Outlook where I can reply all, using an attachment. This is the code: Sub Estimate() Dim origEmail As MailItem Dim replyEmail As MailItem Dim s() As String Dim add As String Set origEmail = Application.ActiveWindow.Selection.Item(1) Set replyEmail = Application.CreateItemFromTemplate("C:\template.oft") s = Split(origEmail.CC & ";" & replyEmail.CC, ";") replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody replyEmail.Subject = "RE: " + origEmail