OOXML - Spreadsheet (.XLSX) created with Ruby won't recalc - ruby

I am building a ruby class/component to use in my Rails projects for creating reports/exports based on Excel .xlsx files. With the component, I can open a "template" .xlsx file, add data in rows to a sheet, save and then download the file to the user. It has been working well for several months now.
Now I need to take a pre-existing .xlsx file (think "form"), open it as a template, insert values in several of the cells, and then save and download to the user. For the most part, the process works. The one hitch is that one of the cells I am updating with data is within a range of cells that gets a SUM function applied to it. The problem: the SUM cell doesn't have the correct sum in it.
I've checked the cell both in Excel upon download, and also the underlying xml - the cell and its data is numeric - not text. When I try to manually recalc the sheet - nada. I can update one of the other cells in the range that is getting SUM'd, and it magically starts working - the SUM cell shows the proper total.
I read a post earlier today that mentioned removing the element from the total field in order to signal to Excel when the spreadsheet is opened that it should recalc - nope.
I'd really like to open source this component once I get this further along; I think it would be a BIG help to the Ruby community. Thanks in advance for any help!

Sounds like you need to set the fullCalcOnLoad attribute of the calcPr element to true:
<workbook>
<calcPr fullCalcOnLoad="1"/>
</workbook>
This will cause the Excel document to perform the caluclations within all the workbooks when the file is opened.

Related

How do I wrap data in BIRT?

I have developed a BIRT report and need to export the output as PDF and as an Excel Spreadsheet. I am looking a solution to wrap data in PDF report exported from BIRT. A text gets truncated in the PDF, if it does not have spaces as soon as it exceeds the available width of the column.
e.g. phone number getting truncated
I would like to know if there is a solution without the need for adding a custom code as provided in How to wrap column data in birt report. This solution adds whitespace to the data which is not desirable when the report is exported to an excel spreadsheet. In essence, this solution manipulates the data which isn't the right thing to do.
I have tried using the Whitespace auto option but that does not work.
I am using BIRT version 4.12.
I was able to figure out the solution for getting the text wrapped in the PDF export. Made use of IPDFRenderOption.PDF_WORDBREAK for the same.
PDFRenderOption pdfOptions = new PDFRenderOption();
pdfOptions.setOutputFileName("T:/temp/filename.pdf");
pdfOptions.setOutputFormat("pdf");
pdfOptions.setOption(IPDFRenderOption.PDF_WORDBREAK, true);
task.setRenderOption(pdfOptions);
task.run();

How to edit numbers of Evernote notes, and make them sync?

I've been trying to format my Evernote notes (thousands of them) so that they are readable on any device.
I've accessed evernote storage on my Mac and saw folders of entries -- every folder contains a note.xhtml and a content.enml files, which directly stores note contents.
I can modify the *.xhtml file, and changes are reflected on Evernote client, but they just won't sync over to the server. Additionally, the *.enml file contains corresponding content to xthml file, but the change won't go there.
Is there any way I can neatly edit my notes, on the HTML level?
Thx!
In AppleScript, it's pretty easy to get and set the HTML. To actually manipulate the HTML you might want another language.
Here's how you read and write HTML content to a single selected Evernote note:
tell application "Evernote"
set noteList to selection
set n to item 1 of noteList
set extractedHtml to HTML content of n
set HTML content of n to "<p>Foo Bar</p><p>foo baz</P>"
end tell
Evernote provides some good examples of using AppleScript on their developer site. You can also use xsltproc for some more systematic manipulation. I have a read-only example of using xslt via AppleScript in a recent post of mine. This above little snippet might be enough of an example to tell you how to set the HTML content.
But, to give you a better answer, I'd need to know a little more about how you want to manipulate your notes. The above example just grabs the first item in your current selection and sets the content.

Showing a picture in visual foxpro 6 from General Data Column [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
What is the code for displaying picture in Visual Foxpro 6?
Does anyone know the codes for displaying a picture that is found within a Column in a table using Visual Foxpro 6?
My project was Library System, that includes the time in and time out of the librarians and students. And needs to upload a picture of students together of their information in the registration.
Example:
If a student enters the Library , he/she needs to swipe his/her ID to login or time in and his/her information will appear on the computer of the admin. Same process when he/she leaves the library . . . he/she needs to swipe his/her ID then logout / time out.
I think your question is vague and misleading based on other answer provided. What is SOUNDS like is that you have a database of teachers and students (much like a membership as a gym or similar). For each record in the database, you have an image file associated with that person. The image may be part of the actual table, or just a file name that is pointing to a specific directory on your drive share, where all the people images are available.
From that, these people have ID cards and when they enter a given facility (your Library for example), they run their ID card through a reader. At that time you are doing a search from your network database of users, find the user and pull up the image to the screen to show who the person is to help prevent fraud of someone using somebody else's ID card. This allows the person monitoring the entry area to make sure that Jim is not using "Bill's ID card to gain access.
If this is the case, and your VFP app is already running and ready to read from the card reader, you should only need to add an image file to your screen for presentation somewhere. Then, based on your finding the appropriate ID, get the record, analyze (if part of the record or just file name in a given images path), get the image file and set the property on the image control to point to the correct image. Then, do whatever logging update that states that Bill just entered the facility.
-- update per comment --
Jenna, I don't know how the original records were added to your table, and it sounds like you were handed this project. The column type within VFP is that of a "General" field. Somewhat like that of a memo field that can also hold binary data, the General data type is more for Object Linking and Embedding (OLE) content. It appears that when users were storing the values, they were adding as a linked or embedded content via something like
APPEND GENERAL YourPictureColumn from SomePath\SomeFileName.bmp
check the syntax under VFP 6 for "APPEND GENERAL". You can also state how via a LINK to the actual file vs EMBEDDING by having the actual image included so if the original source is removed, you still have it in the file.
As for the "picture frame" you see when you double-click this column, it is because VFP does not know how to properly interpret the image, such as as "MS.Paint" class object, or "Picture", or whatever. I've never really liked doing General fields, but would instead have a memo field with just the name of the full path/file name of the image I was keeping and had a separate folder to just stick all the image files. Then, when I needed to show that specific image, I would change the property of the image object on the VFP form to that location.
Now, if that is a route you might like to go with, I'm not exactly sure out to extract those image files, but can look into it more.
As for testing the concept of the image sampling, in VFP, make a new folder for a sample form.
Copy in the folder a few images to sample.
Create a simple table with 2 columns...
CREATE TABLE MyPicSample ;
( PersonName c(10),;
ImgSource m )
Add as many records as images you copied to the test folder. For each, put the file name of the images (full path) into the "ImgSource" memo field, and a sample description for the "PersonName".
Next, create a form, open the data environment and add the "MyPicSample" table just created.
Drag this table from the data environment to the form and it will create a grid on the form. Resize it some you only need a small amount of space to show the one column for PersonName. Close the data environment.
Add an "Image" control to the form. It should default the object name to "Image1"
Double-click on your grid to bring up its code snippet window and then double-click on the "AfterRowColChange" event... paste the following over it..
LPARAMETERS nColIndex
Thisform.Image1.Picture = MyPicSample.ImgSource
Save and run the form. As you scroll up/down the grid, you should see the image change to the respective BMP/JPG file.
I think this is the concept of what you want, but instead of a data table grid displayed, you will be doing this from a scanned card that gets a record, has an image and then present THAT image (now in a General data column type).
Again, not sure how you have your images via embedding or linked, but with this, we can probably get going closer to your end-result needed.
Depends on where you need to upload the image to.
If you are uploading via FTP, you should be able to use the following snippet in Foxpro. It's utilizing the Internet Transfer Control.
inet = CREATEOBJECT("inetctls.inet")
inet.Execute("ftp://ftp.microsoft.com", "CD DIRNAME")
inet.Execute("ftp://ftp.microsoft.com", "PUT LOCALFILE REMOTEFILE")

How to import multiple XML files into one inDesign document without copy/paste?

I use InDesign CS6, and I have several XML files with the same structure. Only the data are
different.
I created an Indesign layout with some tagged placeholder frames on merge mode, for automated layout.
Today for each XML file I have to create a new InDesign document to import
the XML. Everything works fine. Then in order to have all Indesign
layouts one after the other into a single Indesign layout, I have
to use the copy/paste function.
I mean for example, copy the contents of all documents to the first one. Or add pages of other documents to the first one, then delete spaces between each page.
So my question is the following:
How to repeat this process without copy/paste function, knowing that the
number of XML files could be unknown.
Thank you very much for your answer.

How to add a binary file to a datagrid view

im working on a c++ project and i was wondering if i can add the items of a datagrid without using a data base. Using a xxxxxx.dat file. Is that posible?
pd:sorry bout my english, im not an english-speaker.
Create a couple of classes. One to describe a row in the file.
One to open up a list of the above.
add a method to load from the dat file, (and save to it?)
Then just bind your grid to the list class.
Another possible option would be ODBC Text driver, but there area good few ifs and buts around that.

Resources