Issues with export to excel
Issues with export to excel
RA-Novin Posts: 11Questions: 2Answers: 0
edited January 2 in Free community support
I have a problem in exporting my table data to excel. There is a column in my table that contains string data with a structure similar to yyyy-mm-dd (some data like 1401-09-25). While exporting to excel, it is considered as date and in excel it is considered as date which is too large to be displayed.
Please guide me how to solve the issue.
This question has an accepted answers - jump to answer
check the link above for customization options. You will need to convince Excel that it shouldn't interpret your data as a date. The use of one of the built-in styles might work. If not you would need to prefix your data using "customize" or "exportOptions". The prefix could be some text or maybe just a blank space.
Many people have asked similar questions in this forum. I suggest you also search the forum for other relevant threads.
Thanx for your reply.
Actually, I can not use some prefixes because that would ruin the data.
convincing the excel, I already tried all the possibilities that came to my mind, but they did not fix the issue either.
I'll be grateful if you guide me through the right exportOptions that you mentioned because before posting my question I looked for such a solution but I did not succeed.
Have you tried "customize"`? That is the way to tell Excel to treat your column like a string.
It seems that customize should be the answer, but since I am absolutely novice, I did not find the right syntax. Could you kindly privide the syntax. Just suppose I want to specify that a column named "mycolumn" is supposed to be of string type. I realy appreciate that.
I am sorry, but I can't help you to write your code. Fiddling with Excel using "customize" is maximum punishment for a software developer I would say. I mean you need to manipulate Open XML using jQuery for this!
I shared my code using "customize" many times in this forum. You can search for that and see what you can use from it. Good luck and thank you for your understanding.
Thank you very much for your kind consideration, I really appreciate it.
Of interest, this is the part of the code that assigns the column width for the created spreadsheet.
What I'd suggest doing is dumping the document structure in the
customizecallback and find the part that defines the column width and create a selector for that. Then modify the value as you need.
Let us know how you get on with it.
Is this really only about column width? I thought you had a problem that Excel recognizes your field as a date field and hence transforms it instead of leaving it as it is.
Not sure - that's how I read the question, but I might be totally off the base. @RA-Novin perhaps you can clarify for us.
Dear @Allen and Dear @rf1234
I am very very very sorry for replying this late, honestly, I saw your comments accidentally today.
In fact my question was not about column width, it was about Excel recognizing my field as a date field and hence transforming it.
I took @rf1234 suggestion and inserted some prefix to my data and issue was solved. Thanks a lot for it.