xou/elixlsx 190
An Elixir XLSX writer
Application Crash Reports for Android
Make a cool intro for your Android app.
Adapter for the Calendar library in Ecto
date-time and time zone handling in Elixir
Easy permission definitions in Elixir apps!
Elixir authorization library for Plug applications.
GoCD user documentation
download or record radio stream, wrapper for streamripper
startedolexale/flutter_roadmap
started time in 13 hours
startedKotlin/kotlin-interactive-shell
started time in 17 hours
startedargoproj/argo-events
started time in a day
startedargoproj/argo-ci
started time in a day
startedAirtable/airtable.js
started time in 2 days
startedThePrimeagen/harpoon
started time in 2 days
startedRalim/IronOS
started time in 3 days
startedgkoberger/avataaars
started time in 4 days
startedibraheemdev/modern-unix
started time in 5 days
startedibraheemdev/modern-unix
started time in 5 days
Pull request review commentxou/elixlsx
sheet6 = # nest further |> Sheet.group_cols("C", "D") ++# Autofilter can be applied to allow filtering a range+sheet7 =+ %Sheet{+ name: "Autofilter columns",+ rows: [+ [1, 2, 3],+ [4, 5, 6],+ [7, 8, 9],+ [10, 11, 12],+ [13, 14, 15],+ ]+ }+ # first you select the filtering range
First of all, I would like to clear up a misconception. An autofilter does not apply to a single column, but a range. E.g. assume you have names, postal codes, and adresses in column A, B, and C respectively. Then a filtering based on say a postal code applies to all three columns, if they are all selected as the filtering range.
Next, to answer your question. In Excel if you create a filtering range without selecting any filter, you will see dropdown carets on each column in the filtering range (for selecting a filter obviously), but with no filter applied yet. No harm done, and it may actually be beneficial, as you might want to generate a worksheet with a filtering range but no filters applied as a convenience for your users.
comment created time in 5 days
Pull request review commentxou/elixlsx
defmodule Elixlsx.Sheet do def remove_pane_freeze(sheet) do %{sheet | pane_freeze: nil} end+++ @spec set_autofilter(Sheet.t(), String.t(), String.t()) :: Sheet.t()+ @doc ~S"""+ Set the range for autofiltering+ """+ def set_autofilter(sheet, start_cell, end_cell) do+ {row1, col1} = Util.from_excel_coords(start_cell)+ {row2, col2} = Util.from_excel_coords(end_cell)+ set_autofilter(sheet, row1, col1, row2, col2)+ end++ @spec set_autofilter(Sheet.t(), number, number, number, number) :: Sheet.t()+ @doc ~S"""+ Set the range for autofiltering+ """+ def set_autofilter(sheet, row1, col1, row2, col2) do+ %{sheet | autofilter_ref: {row1, col1, row2, col2}}+ end+++ @spec append_list_filter(Sheet.t(), String.t(), list(any())) :: Sheet.t()+ @doc ~S"""+ Add filter on a column as a list of inclusive elements+ """+ def append_list_filter(sheet, column, filters) when is_binary(column) do+ append_list_filter(sheet, Util.decode_col(column), filters)+ end++ @spec append_list_filter(Sheet.t(), number, list(any())) :: Sheet.t()+ @doc ~S"""+ Add filter on a column as a list of inclusive elements+ """+ def append_list_filter(sheet, column, filters) do+ update_in(sheet.autofilter_cols, &Map.put(&1, column, {:list, filters}))+ end+++ @spec append_criteria_filter(Sheet.t(), String.t(), operator, any()) :: Sheet.t()+ @doc ~S"""+ Add filter on a column as an operator-based criteria
It is documented now.
comment created time in 5 days
Pull request review commentxou/elixlsx
defmodule Elixlsx.XMLTemplates do end end + defp make_autofilter(nil, filter_cols) do+ ""+ end++ defp make_autofilter(autofilter_ref, filter_cols) do+ {row1, col1, row2, col2} = autofilter_ref++ """+ <autoFilter ref="#{Util.to_excel_coords(row1, col1)}:#{Util.to_excel_coords(row2, col2)}">+ """ <>+ make_filter_columns(autofilter_ref, filter_cols) <>+ """+ </autoFilter>+ """+ end++ defp make_filter_columns(autofilter_ref, filter_cols) do+ {_row1, col1, _row2, col2} = autofilter_ref++ Enum.map_join(filter_cols, fn col, {filter_type, filters} ->+ if col < col1 or col > col2 do+ # Filter column out of autofilter range+ ""+ else+ # Filter columns are relative to first column in the autofilter.+ make_filter_column(col - col1, filter_type, filters)+ end+ end)+ end++ defp make_filter_column(col_id, filter_type, filters) do+ """+ <filterColumn colId="#{col_id}">+ """ <>+ if filter_type == :list, do: make_filters(filters), else: make_custom_filters(filters) <>+ """+ </filterColumn>+ """+ end++ defp make_filters(filters) do+ non_blanks = Enum.reject(filters, fn filter -> filter != :blank end)++ blank = length(filters) != length(non_blanks)+ """+ <filters blank="#{blank}">+ """ <>+ Enum.map_join(non_blanks, &make_filter/1)+ """+ </filters>+ """+ end++ defp make_filter({%DateTime{year: year, month: month, day: day, hour: hour, minute: minute, second: second} = date, grouping}) do+ """+ <dateGroupItem year="#{year}" month="#{month}" day="#{day}" hour="#{hour}" minute="#{minute}" second="#{second}" dateTimeGrouping="#{grouping}"/>+ """+ end++ defp make_filter(val) do+ "<filter val=\"#{val}\"/>"+ end++ def make_custom_filters(expr) do
It most definitely should. I have fixed it now.
comment created time in 5 days
startedseekshiva/react-native-remote-svg
started time in 7 days