- Timestamp:
- 2019-06-26T16:48:48+12:00 (5 years ago)
- Location:
- main/trunk/model-sites-dev/heritage-nz/collect/pdf-reports/prepare
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/heritage-nz/collect/pdf-reports/prepare/xls-to-csv.py
r33222 r33224 143 143 header_name = u"TLA" 144 144 145 # header_name_utf8 = unicode(header_name).encode("utf-8")146 145 header_name_utf8 = header_name.encode("utf-8") 147 146 metadata_name_utf8 = header_name_utf8.replace(" ", "") … … 184 183 # Check to see if companion PDF file present 185 184 # pdf_filename = os.path.join(excel_dirname,"pdfs",formatted_cell_value+".pdf") 186 id = formatted_cell_value.replace(" "," ")185 id = formatted_cell_value.replace(" ","-") 187 186 188 187 pdf_file = id_to_relative_pdf_file(id) … … 202 201 print "Unbound id: '" + id + "'" 203 202 204 if isinstance(formatted_cell_value, basestring): 205 # Remove any trailing whitespace. 206 # Newline at end particular harmful for a entry in the CSV file 207 formatted_cell_value = formatted_cell_value.rstrip(); 208 209 # formatted_cell_value_utf8 = unicode(formatted_cell_value).encode("utf-8") 203 # if isinstance(formatted_cell_value, basestring): 204 # # Remove any trailing whitespace. 205 # # Newline at end particular harmful for a entry in the CSV file 206 # formatted_cell_value = formatted_cell_value.rstrip(); 207 210 208 formatted_cell_value_utf8 = formatted_cell_value.encode("utf-8") 211 209 -
main/trunk/model-sites-dev/heritage-nz/collect/pdf-reports/prepare/xls-to-sanitized-csv.py
r33222 r33224 11 11 worksheet = workbook.sheet_by_index(xlsutil.worksheet_index_pos) 12 12 ## worksheet = workbook.sheet_by_name(xlsutil.worksheet_name) 13 14 # excel_filename_split = os.path.split(excel_filename)15 # excel_dirname = excel_filename_split[0]16 # excel_file = excel_filename_split[1]17 # excel_file_splitext = os.path.splitext(excel_file)18 # excel_file_root = excel_file_splitext[0];19 20 # sanitized_csv_filename = os.path.join("for-download",excel_file_root+".csv")21 13 22 14 sanitized_csv_ofile = open(sanitized_csv_filename, 'wb') … … 49 41 header_col_j = header_names_mapping[header_name] 50 42 51 # cell_value = worksheet.cell_value(row_i,header_col_j)52 #53 # cell_value_utf8 = unicode(cell_value).encode("utf-8")54 55 43 cell_value_unicode = xlsutil.cell_value_tidy_unicode(worksheet,row_i,header_col_j) 56 57 44 cell_value_utf8 = cell_value_unicode.encode("utf-8") 58 59 ## cell_value_utf8 = unicode(cell_value).encode("utf-8")60 45 61 46 sanitized_utf8_row.append(cell_value_utf8)
Note:
See TracChangeset
for help on using the changeset viewer.