Pass information to writer / calc as it opens

Is it possible to pass information to writer / calc as it opens? I have a program that generates some number. I want the number to display in writer or calc after the program computes. The program is written in Java and I am printing the output to console right now. I was thinking maybe having a line in the program to launch writer with the number. Any easy way to display the number in writer or calc like with a command line or some sort (i.e. open writer -56.777) ? Thank you.

You want to open an empty document having just that number or a specific Document having older content?