ejsExcel
ejsExcel copied to clipboard
Can I erase a column based on a variable?
I want to be able to evaluate a property (or an if) and delete a column, in the same way that we can delete a sheet (<%_deleteSheet_()%>
). Is that possible?
You can not erase a column. But you can build a new array before <%forRow or <%forCell or <%forCBegin and so on.
<%
const oldArray = ["a", "b", "c"];
const buildNewArray = ["a", "c"];
%>
<%forCell str in buildNewArray%><%=str%>
Otherwise, <%%> can run all javascript code.
<% console.log("run javascript code"); %>
The problem with that approach is that we have conditions and styles for columns that are not provided by us, but by operational team. It means, we wanted to use an template file with all usecases and just delete the columns that were not interesting for an specific usecase.
And: what is the main difficulty to implement this feature (deleteColumn()
)? Maybe our team could help with that. :)
First, Thank you for you propose. It is very helpfull. We will think it. Second, Now, You can use VBA to implement that. Template can use all excel function include the VBA.
<%_deleteSheet_()%>
Can also to try. It will delete current sheet.
Yep, but we need to delete only one or two columns. Otherwise we would have to create a lot of sheets to contemplate every usecase.
We are going to fork the lib to try to implement the deleteColumn
, ok? And we could offer docs in english and portuguese as well, if you like.
Of course OK, Thank you very much!
deleteColumn
change the name to deleteCell
maybe better.
How about shiftColumns
? Because what we really need is to shift all columns one house from left to right when we delete a column.
Yes, shiftCell
.
I Think. Column
means that a whole column, so Cell
will be better.
Excel inside also is Cell
, not Column
.
May I know when this 'deleteCell' can be ready? I also wanna use it. Now when I use <% if %> condition in the template, it always keep empty rows there which is not expected... :(
<%ifCBegin "1"==="1"%><%="abcd--ifCBegin"%> <%ifCEnd%>
<%ifCBegin "1"==="2"%><%="abcd--ifCBegin"%> <%ifCEnd%>