I'm using OpenOffice calc (or rather the Libreoffice verion in Ubuntu 11.04). I used the hyperlink function to add links to a column using the function: =hyperlink("http://www.ncbi.nlm.nih.gov/pubmed?term="&D2,D2)
All appears okay on the spreadsheet, but when I save as html, the links column is saved as plain text and not as hyperlinks to where I want them to go to!
Am I doing something wrong?
Thanks!
You could report a bug, but it looks like the underlying problem is that the spreadsheet formulas are removed when saving to html, something as simple as A1*3 is not converted to javascript, and the hyperlink() function isn't converted either. If you insert a link with Insert -> Hyperlink it should work fine.
Related
I'm using MS Word to create rtf templates for Oracle BI Publisher.
My goal is to conditionally assign a color to the title in the header section.
My xsl code looks like this:
<?if:DRUCKTITEL ="NICHT FREIGEGEBEN"?><xsl:attribute name="color">red</xsl:attribute><?end if?><?DRUCKTITEL?>
I expect the words "NICHT FREIGEGEBEN" to appear in red, however what I get is this:
It seems BI Publisher has a problem with changing font color even when the code gets interpreted as code.
I settled on a work around of putting text formatted in red in Word inside the if clause instead of the xsl-code.
This works and while it looks weird in the layout it leads to the wanted result.
Try:
<?attribute#incontext:color;'red'?>
Or, you can use this inside of a field's "Help Text" or BI Publisher code section.
<xsl:attribute xdofo:ctx="block" name="color">red</xsl:attribute>
I highly recommend installing the desktop tool if you have not already done so.
I'm using the following code to add a Macro to Excel. I notice that the data / other WorkSheets from the original Excel had dropped completely but the Macro is showing.
This is the code that I am using:
import xlsxwriter
workbooks = xlsxwriter.Workbook('C:\\Users\\user\Desktop\\test.xlsm')
workbooks.add_vba_project('C:\\Users\\user\\Desktop\\vbaProject.bin')
workbooks.close()
I used the link http://xlsxwriter.readthedocs.io/example_macros.html and it seems to be the same from another page https://redoakstrategic.com/pythonexcelmacro/
I wondered if there is another library that I should use for this?
I tried the following link Use Python to Inject Macros into Spreadsheets it seems that here again the data from the original file is overwritten. Not sure if this is a duplicate or not, or if I missed something rather obvious ?
Thanks
Unfortunately, xlsxwriter can't load information from already existing Excel workbooks; it is only used for making new ones. You are overwriting your old workbook with a blank one that has your macros.
If you need to load information, look into openpyxl. It can be used for creating .xlsm files.
One way around it is to create the macro you want in another Excel so we can execute it to affect the other Excel. Then using win32.com it runs the VBA.
enter code here
#import win32com.client
#xl=win32com.client.Dispatch("Excel.Application")
#xl.Workbooks.Open(Filename="C:\\macro.xlsm",ReadOnly=1)
#xl.Application.Run("macro")
#xl = 0
I have a Google Docs template which is automatically copied into a folder and replace specific values with values coming from spreadsheet cells.
The template contains values such as <<41>> which are used to be "find-and-replaced" with values coming from a spreadsheet.
The find-and-replace process is fine, and the results of the document looks like this image below
Now, I want this document to be converted into PDF after it has been updated, so I made a function for the convertion and call it at the bottom after all the codes has been executed.
Here's the function:
//convert to PDF
function convertPDF(FileID,newName) {
Utilities.sleep(120000);
docblob = DocumentApp.openById(FileID).getAs('application/pdf');
/* Add the PDF extension */
docblob.setName(newName + ".pdf");
var file = DriveApp.createFile(docblob);
}
The convertion works fine, but the converted document isn't updated. Rather, it is like it was the one freshly copied from the template, before the values were changed.
If you may notice, I have added a "sleep" timer before in the conversion function so as to delay the conversion and give time for the changes to be saved, I've tried 1 and 2 minutes sleep but still it doesn't work.
What can I do to make sure the PDF is created from the updated template?
The function I provided above works fine, we just need to forced the script to save the changes by calling the saveAndClose() method before calling the function that converts the doc into PDF.
I was searching for an answer for this same problem but for Google Sheets. Gave saveAndClose() a shot, but it didn't work for Sheets. Did some more searching and found that the Sheets solution for a similar problem is:
SpreadsheetApp.flush()
Here is the relevant Question/Answer.
Hope this helps someone get to their answer faster.
I am using Workbook gem to preview the excel file without page breaks in my website. Right now, I am successful in extracting the excel file and writing it into html format and display as preview.
The following code extracts and writes the excel to html:
excel_file = Workbook::Book.open "#{file_url}"
excel_file.write_to_html(file_name + ".html")
But this gives me an unformatted html sheet with no rows and columns or any of the existing excel file.
According to murb/workbook documentation, it is said that we can pass the format as a hash within its options.
write_to_html(filename = "#{title}.html", options = {})
So, to achieve the format hash, I tried the following code:
excel_file.template.formats
But this returns a null hash. So, how can i get all the formats from the excel file and write to html? Or at least show the html table with borders for all rows and columns.
The author here. The Workbook gem is mainly built to extract and rerepresent the data in files, and not so much the formatting. In the past I made a few attempts on adding support to maintain formatting when converting, but it is far from complete. Some importers don't even set the formatting hash as you found out, notably the xlsx importer needs work on this.
The HTML was built to simply give a basic preview of the data. It basically returns a html-page with all tables which is by default unformatted, although format-names are used in the classes. There is an option though, if you'd pass style_with_inline_css: true... but then it requires an importer to actually set the format hash properly...
I'm happy to guide you here and there when you want to improve the xlsx importer code to suit your needs and hopefully the workbook gem in general, but it will need serious work if you want more than just some background colours and font properties.
One of the fields in my database table is named DATEOFDISCHARGEFROMITU. In any report output, this displays as DATEOFDISCHARGEFRU. I've figured out that the missing characters form the word 'OMIT', which makes me think it's related to this old problem in a previous version of ApEx (I'm using version 4.1.)
Is there a way to display the whole field name in the report header when the field name contains the string 'OMIT'?
Note: Using html character codes will allow the field name to display properly, but then when the report is exported to CSV the character codes are of course shown instead of the full field name. I need a solution that works for exports as well as displaying onscreen.
Platforms (tested): Oracle Application Express (APEX), Version 4.0.2
Note: I am not sure how the linked OTN post is relevant to your problem aside from the coincidence that their file export contains the word "OMIT" and your column title contains the word "OMIT".
It's safe to say that "OMIT" isn't an APEX or ORACLE reserved word that is sabotaging your output. However, if you were talking about a scrap of SQL that attempted to create a table named "SELECT" or "WHERE"
i.e., SELECT * FROM "SELECT" WHERE...
you'll be blocked by the RDBMS from proceeding. :)
I tried an export with a query that contained a column header labeled "OMIT" (see the far right in the example.) The .csv file interpreted by Microsoft Excel looked like this:
I wrote up a separate Q&A post about creating dynamic APEX report headers to answer your follow-on question about a suitable solution for providing a clean, htmlcode-free output when a report is eventually exported to a text, comma separated (or other delimited) output.
In summary, the linked post suggests to set up a dynamic PL/SQL Function within a page item. The page item can be referenced directly in the report column header definition. This is a screenshot demonstrating a possible solution:
The link to the general explanation has more details on the APEX design tasks that gets to this final product.
Onward.
I solved this by using this solution for exporting to csv without an enclosing quote character - as that was another challenge I was faced with for the particular application I was developing. By manually creating the export file I was also able to define the column headings exactly, and the "OMIT" issue did not occur.
Technically that's not a solution for displaying a report with the required headings that can also be exported (Richard's response does that) but it does what I need it to and solves the immediate problem of the DATEOFDISCHARGEFROMITU column heading.