mjul / docjure

Read and write Office documents from Clojure
MIT License
619 stars 129 forks source link

Simplest way to place data #109

Closed sittim closed 9 months ago

sittim commented 1 year ago

I am looking for a way to place data at a starting cell, for example, here is the data set:

[[42.57970809936523 18 16 16 5.060728744939271E-4 2.2993113232317564 5.010870154611686E-4]
 [42.57970809936523 15177 14116 14116 0.6050866962305986 2028.567414921217 0.5730249932314525]
 [42.57970809936523 16657 15493 15493 0.666150997782705 2226.45189567685 0.6338104146982463]
 [42.57970809936523 16524 15369 15369 0.6606521064301552 2208.632232921804 0.6283144276042232]
 [42.57970809936523 14463 13452 13452 0.576313300428627 1933.1459950070994 0.5445427324990252]
 [42.57970809936523 16902 15721 15721 0.6762618625277161 2259.217082032903 0.6 439274112780042]
 [42.57970809936523 16758 15587 15587 0.670319512195122 2239.960349700837 0.6379796566550952]
 [42.57970809936523 17819 16574 16574 0.7140889135254989 2381.7991169526954 0.6819092083393065]
 [42.57970809936523 15990 14872 14872 0.6386121951219512 2137.2098749439174 0.6063302738256874]
 [42.98550415039062 16104 14998 14998 0.64419977827051 2172.5085761404066 0.6126397740359484]
 [42.98550415039062 12625 11758 11758 0.5005190687361418 1703.1841471035407 0.4708104680766605]
 [42.98550415039062 18049 16810 16810 0.7245545454545455 2434.9826086758394 0.6932577431812779]
 [42.98550415039062 18146 16900 16900 0.7285456762749446 2448.019398371308 0.6972862305104703]
 [42.98550415039062 16490 15358 15358 0.6601643015521064 2224.6557349222808 0.6285824361337145]
 [42.98550415039062 17284 16097 16097 0.6929359201773836 2331.702263643961 0.6614243916185162]]

How do I place it where the very first value 42.57970809936523 is in a specific cell such as A7 ?

mjul commented 1 year ago

Since you are asking for the simplest solution, prepending the right amount of blank lines and columns is probably the way to do it. You can do this in you client code with a few lines.

Alternatively you can extend the Docjure library with a function to place data. In that case you can do the "simple" thing like above or reach into the underlying POI API for adding Cell to Row with the correct cell location. This would be more robust.

sittim commented 1 year ago

Thank you, that sounds reasonable. Unfortunately, I am knowledgeable enough to extend the capability, but I just wanted to make sure I am not missing something, thank you for confirming.