Class kartik\export\ExportMenu
ExportMenu widget allows exporting tabular structure data to various formats using the PhpSpreadsheet library. The widget extends the kartik\grid\GridView widget, and reads the source data via a $dataProvider very similar to the kartik\grid\GridView.
For example,
use kartik\export\ExportMenu;
$gridColumns = [
['class' => 'yii\grid\SerialColumn'],
'id',
'name',
'color',
'publish_date',
'status',
['class' => 'yii\grid\ActionColumn'],
];
// Renders a export dropdown menu
echo ExportMenu::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns,
'clearBuffers' => true, //optional
]);
// You can choose to render your own GridView separately
echo \kartik\grid\GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => $gridColumns
]);
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$afterFooter | array|string | Configuration of additional footer table rows that will be rendered after the default grid footer row. | kartik\grid\GridViewTrait |
$afterHeader | array|string | Configuration of additional header table rows that will be rendered after default grid header row. | kartik\grid\GridViewTrait |
$afterRow | Closure | An anonymous function that is called once AFTER rendering each data model. | yii\grid\GridView |
$afterSaveView | string|boolean | The view file to show details of exported file link. | kartik\export\ExportMenu |
$asDropdown | boolean | Whether to render the export menu as bootstrap button dropdown widget. | kartik\export\ExportMenu |
$autoIdPrefix | string | The prefix to the automatically generated widget IDs. | yii\base\Widget |
$autoWidth | boolean | Whether to auto-size the excel output column widths. | kartik\export\ExportMenu |
$autoXlFormat | boolean | Determines whether the exported EXCEL cell data will be automatically guessed and formatted based on kartik\grid\DataColumn::$format property. | kartik\grid\GridViewTrait |
$batchSize | integer | Fetch models from the dataprovider using batches of this size. | kartik\export\ExportMenu |
$beforeFooter | array|string | Configuration of additional footer table rows that will be rendered before the default grid footer row. | kartik\grid\GridViewTrait |
$beforeHeader | array|string | Configuration of additional header table rows that will be rendered before the default grid header row. | kartik\grid\GridViewTrait |
$beforeRow | Closure | An anonymous function that is called once BEFORE rendering each data model. | yii\grid\GridView |
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component. | yii\base\Component |
$bootstrap | boolean | Whether the grid view will have Bootstrap table styling. | kartik\grid\GridViewTrait |
$bordered | boolean | Whether the grid will have a bordered style. |
kartik\grid\GridViewTrait |
$boxStyleOptions | array | The output style configuration options for the entire spreadsheet box range. | kartik\export\ExportMenu |
$bsColCssPrefixes | array | The bootstrap grid column css prefixes mapping, the key is the bootstrap versions, and the value is an array containing the sizes and their corresponding grid column css prefixes. | kartik\base\BootstrapTrait |
$bsCssMap | array | CSS conversion mappings across bootstrap library versions. | kartik\base\BootstrapTrait |
$bsExtBasename | integer | The yii2 bootstrap extension base name (readonly property available via getter method getBsExtBasename()) | kartik\base\BootstrapTrait |
$bsVer | integer | Bootstrap version number currently set (readonly property available via getter method getBsVer()) | kartik\base\BootstrapTrait |
$bsVersion | integer|string | The bootstrap library version that you wish to use for this specific extension / widget. | kartik\base\BootstrapTrait |
$caption | string | The caption of the grid table | yii\grid\GridView |
$captionOptions | array | The HTML attributes for the caption element. | yii\grid\GridView |
$clearBuffers | boolean | Whether to clear all previous / parent buffers. | kartik\export\ExportMenu |
$colSelFlagParam | string | The column selector flag parameter for export form | kartik\export\ExportMenu |
$columnBatchToggleSettings | array | The settings for the toggle all checkbox to check / uncheck the columns as a batch. | kartik\export\ExportMenu |
$columnSelector | array | The configuration of the column names in the column selector. | kartik\export\ExportMenu |
$columnSelectorMenuOptions | array | The HTML attributes for the column selector menu list. | kartik\export\ExportMenu |
$columnSelectorOptions | array | The HTML attributes for the column selector dropdown button. | kartik\export\ExportMenu |
$columns | array | Grid column configuration. | yii\grid\GridView |
$condensed | boolean | Whether the grid will have a condensed style. |
kartik\grid\GridViewTrait |
$container | \kartik\export\array, | HTML attributes for the container to wrap the widget. | kartik\export\ExportMenu |
$containerOptions | array|boolean | The HTML attributes for the grid container. | kartik\grid\GridViewTrait |
$contentAfter | array | An array of rows to append after the footer row. | kartik\export\ExportMenu |
$contentBefore | array | An array of rows to prepend in front of the grid used to create things like a title. | kartik\export\ExportMenu |
$counter | integer | A counter used to generate $id for widgets. | yii\base\Widget |
$dataColumnClass | string | The default data column class if the class name is not explicitly specified when configuring a data column. | yii\grid\GridView |
$dataProvider | yii\data\DataProviderInterface | The data provider for the view. | yii\widgets\BaseListView |
$dataValidation | array|null | Data for creating excel data validation. | kartik\export\ExportMenu |
$defaultBtnCss | string | Default bootstrap button CSS (readonly property available via getter method getDefaultBtnCss()) | kartik\base\BootstrapTrait |
$defaultIconPrefix | string | Default icon prefix (readonly property available via getter method getDefaultIconPrefix()) | kartik\base\BootstrapTrait |
$defaultPagination | string | The default pagination that will be read by toggle data. | kartik\grid\GridViewTrait |
$deleteAfterSave | boolean | Whether to delete file after saving file to $folder and when $stream is false . |
kartik\export\ExportMenu |
$disabledColumns | array | The column indexes for export that will be disabled for selection in the column selector. | kartik\export\ExportMenu |
$docProperties | array | The \PhpOffice\PhpSpreadsheet\Spreadsheet document properties | kartik\export\ExportMenu |
$dropdownClass | string | Bootstrap dropdown class name based on currently configured bootstrap version (readonly property available via getter method getDropdownClass()) | kartik\base\BootstrapTrait |
$dropdownOptions | array | The HTML attributes for the export button menu. | kartik\export\ExportMenu |
$dynagrid | boolean | Enable dynagrid for column selection. | kartik\export\ExportMenu |
$dynagridOptions | array | Dynagrid widget options. | kartik\export\ExportMenu |
$editedRowConfig | array | The configuration for the row being currently edited | kartik\grid\GridViewTrait |
$emptyCell | string | The HTML display when the content of a cell is empty. | yii\grid\GridView |
$emptyText | string|false | The HTML content to be displayed when $dataProvider does not have any data. | yii\widgets\BaseListView |
$emptyTextOptions | array | The HTML attributes for the emptyText of the list view. | yii\widgets\BaseListView |
$enableAutoFormat | boolean | Enable or disable cell formatting by auto detecting the grid column alignment and format. | kartik\export\ExportMenu |
$enableEditedRow | boolean | Whether to enable focused edited row feature | kartik\grid\GridViewTrait |
$enableFormatter | boolean | Whether to enable the yii gridview formatter component. | kartik\export\ExportMenu |
$encoding | string | Encoding for the downloaded file header. | kartik\export\ExportMenu |
$export | array|boolean | The grid export menu settings. | kartik\grid\GridViewTrait |
$exportColsParam | string | The export columns input parameter for export form | kartik\export\ExportMenu |
$exportColumnsView | string | The view file for rendering the columns selection | kartik\export\ExportMenu |
$exportConfig | array | The export configuration. | kartik\export\ExportMenu |
$exportContainer | array | The HTML attributes for the export button group container. | kartik\grid\GridViewTrait |
$exportConversions | array | Conversion of defined patterns in the grid cells as a preprocessing before the gridview is formatted for export. | kartik\grid\GridViewTrait |
$exportFormHiddenInputs | array | The configuration of additional hidden inputs that will be rendered with the export form. | kartik\export\ExportMenu |
$exportFormOptions | array | The HTML attributes for the export form. | kartik\export\ExportMenu |
$exportFormView | string | The view file for rendering the export form. | kartik\export\ExportMenu |
$exportRequestParam | string | The request parameter ($_GET or $_POST) that will be submitted during export. | kartik\export\ExportMenu |
$exportType | string | The data output format type. | kartik\export\ExportMenu |
$exportTypeParam | string | The export type input parameter for export form | kartik\export\ExportMenu |
$filename | string | The exported output file name. | kartik\export\ExportMenu |
$filterErrorOptions | array | The options for rendering every filter error message. | yii\grid\GridView |
$filterErrorSummaryOptions | array | The options for rendering the filter error summary. | yii\grid\GridView |
$filterModel | yii\base\Model|null | The model that keeps the user-entered filter data. | yii\grid\GridView |
$filterOnFocusOut | boolean | Whatever to apply filters on losing focus. | yii\grid\GridView |
$filterPosition | string | Whether the filters should be displayed in the grid view. | yii\grid\GridView |
$filterRowOptions | array | The HTML attributes for the filter row element. | yii\grid\GridView |
$filterSelector | string | Additional jQuery selector for selecting filter input fields | yii\grid\GridView |
$filterUrl | string|array|null | The URL for returning the filtering result. | yii\grid\GridView |
$floatFooter | boolean | Whether the grid will have a floating table footer. | kartik\grid\GridViewTrait |
$floatHeader | boolean | Whether the grid will have a floating table header. | kartik\grid\GridViewTrait |
$floatHeaderOptions | kartik\grid\GridViewTrait | ||
$floatOverflowContainer | kartik\grid\GridViewTrait | ||
$floatPageSummary | boolean | Whether the grid table will have a floating page summary at the bottom or top depending on
pageSummaryPosition . |
kartik\grid\GridViewTrait |
$folder | string | The folder to save the exported file. | kartik\export\ExportMenu |
$fontAwesome | boolean | Whether to use font awesome icons for rendering the icons as defined in $exportConfig. | kartik\export\ExportMenu |
$footerContainer | array | The HTML options for the table tfoot container. |
kartik\grid\GridViewTrait |
$footerRowOptions | array | The HTML attributes for the table footer row. | yii\grid\GridView |
$formatter | array|yii\i18n\Formatter|null | The formatter used to format model attribute values into displayable texts. | yii\grid\GridView |
$groupedRowStyle | array | The PhpSpreadsheet style configuration for a grouped grid row | kartik\export\ExportMenu |
$hashExportConfig | Whether to hash export config and prevent data tampering of the export config when transmitting this between
client and server during grid data export. Defaults to true . You may set this to false if your config
contains dynamic data (like current date time). However, note that when false it adds the possibility of
your client data being tampered during grid export when read by server. |
kartik\grid\GridViewTrait | |
$headerContainer | array | The HTML options for the table thead . |
kartik\grid\GridViewTrait |
$headerRowOptions | array | The HTML attributes for the table header row. | yii\grid\GridView |
$headerStyleOptions | array | The output style configuration options for the header row. | kartik\export\ExportMenu |
$hideResizeMobile | boolean | Whether to hide resizable columns for smaller screen sizes (< 768px). | kartik\grid\GridViewTrait |
$hover | boolean | Whether the grid will highlight row on hover . |
kartik\grid\GridViewTrait |
$i18n | array | The the internalization configuration for this widget. | kartik\base\TranslationTrait |
$id | string|null | ID of the widget. Note that the type of this property differs in getter and setter. See getId() and setId() for details. | yii\base\Widget |
$initProvider | boolean | Whether to initialize data provider and clear models before rendering. | kartik\export\ExportMenu |
$itemLabelAccusative | string | The default label shown for each record in the grid (accusative case). | kartik\grid\GridViewTrait |
$itemLabelFew | string | The default label shown for each record in the grid (plural). | kartik\grid\GridViewTrait |
$itemLabelMany | string | The default label shown for each record in the grid (plural). | kartik\grid\GridViewTrait |
$itemLabelPlural | string | The default label shown for each record in the grid (plural). | kartik\grid\GridViewTrait |
$itemLabelSingle | string | The default label shown for each record in the grid (singular). | kartik\grid\GridViewTrait |
$krajeeDialogSettings | array | Configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts | kartik\export\ExportMenu |
$layout | string | The layout that determines how different sections of the list view should be organized. | kartik\grid\GridViewTrait |
$linkFileName | string | The name of the file to be appended to $linkPath to generate the complete link. | kartik\export\ExportMenu |
$linkPath | string | The web accessible path for the saved file location. | kartik\export\ExportMenu |
$messages | \kartik\export\array, | The configuration of various messages that will be displayed at runtime: - allowPopups: string, the message to be shown to disable browser popups for download. | kartik\export\ExportMenu |
$moduleId | string | The module identifier if this widget is part of a module. | kartik\grid\GridViewTrait |
$noExportColumns | array | The column indexes for export that will not be exported at all nor will they be shown in the column selector | kartik\export\ExportMenu |
$onGenerateFile | Closure | The callback function to be executed after the output file is generated. | kartik\export\ExportMenu |
$onInitExcel | Closure | The callback function on initializing the PhpSpreadsheet library. | kartik\export\ExportMenu |
$onInitSheet | Closure | The callback function to be executed on initializing the active sheet. | kartik\export\ExportMenu |
$onInitWriter | Closure | The callback function on initializing the writer. | kartik\export\ExportMenu |
$onRenderDataCell | Closure | The callback function to be executed on rendering each body data cell content. | kartik\export\ExportMenu |
$onRenderFooterCell | Closure | The callback function to be executed on rendering the footer cell output content. | kartik\export\ExportMenu |
$onRenderHeaderCell | Closure | The callback function to be executed on rendering the header cell output content. | kartik\export\ExportMenu |
$onRenderSheet | Closure | The callback function to be executed on rendering the sheet. | kartik\export\ExportMenu |
$options | array | The HTML attributes for the container tag of the grid view. | yii\grid\GridView |
$pageSummaryContainer | kartik\grid\GridViewTrait | ||
$pageSummaryPosition | string | Location of the page summary row (whether POS_TOP or POS_BOTTOM) | kartik\grid\GridViewTrait |
$pageSummaryRowOptions | kartik\grid\GridViewTrait | ||
$pager | array | The configuration for the pager widget. | yii\widgets\BaseListView |
$panel | array | The panel settings for displaying the grid view within a bootstrap styled panel. | kartik\grid\GridViewTrait |
$panelAfterTemplate | string | The template for rendering the `{after} part in the layout templates. | kartik\grid\GridViewTrait |
$panelBeforeTemplate | string | The template for rendering the `{before} part in the layout templates. | kartik\grid\GridViewTrait |
$panelFooterTemplate | string | The template for rendering the panel footer. | kartik\grid\GridViewTrait |
$panelHeadingTemplate | string | The template for rendering the panel heading. | kartik\grid\GridViewTrait |
$panelPrefix | string | The panel CSS prefix that will be applied to the panel container for rendering the grid within a bootstrap styled panel. | kartik\grid\GridViewTrait |
$panelTemplate | string | The template for rendering the grid within a bootstrap styled panel. | kartik\grid\GridViewTrait |
$perfectScrollbar | boolean | Whether pretty perfect scrollbars using perfect scrollbar plugin is to be used. | kartik\grid\GridViewTrait |
$perfectScrollbarOptions | array | The plugin options for the perfect scrollbar plugin. | kartik\grid\GridViewTrait |
$persistResize | boolean | Whether to store resized column state using local storage persistence (supported by most modern browsers). | kartik\grid\GridViewTrait |
$phpSpreadsheet | \PhpOffice\PhpSpreadsheet\Spreadsheet | The current \PhpOffice\PhpSpreadsheet\Spreadsheet object instance | kartik\export\ExportMenu |
$phpSpreadsheetWorksheet | \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet | The current \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance | kartik\export\ExportMenu |
$phpSpreadsheetWriter | \PhpOffice\PhpSpreadsheet\Writer\BaseWriter | The current \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance | kartik\export\ExportMenu |
$pjax | boolean | Whether the grid view will be rendered within a pjax container. | kartik\grid\GridViewTrait |
$pjaxContainerId | string | The pjax container identifier inside which this menu is being rendered. | kartik\export\ExportMenu |
$pjaxSettings | array | The pjax settings for the widget. | kartik\grid\GridViewTrait |
$placeFooterAfterBody | boolean | Whether to place footer after body in DOM if $showFooter is true | yii\grid\GridView |
$replaceTags | array | Tags to replace in the rendered layout. | kartik\grid\GridViewTrait |
$resizableColumns | boolean | Whether to allow resizing of columns | kartik\grid\GridViewTrait |
$resizableColumnsOptions | array | The resizableColumns plugin options | kartik\grid\GridViewTrait |
$resizeStorageKey | string | Resizable unique storage prefix to append to the grid id. | kartik\grid\GridViewTrait |
$responsive | boolean | Whether the grid will have a responsive style. |
kartik\grid\GridViewTrait |
$responsiveWrap | boolean | Whether the grid will automatically wrap to fit columns for smaller display sizes. | kartik\grid\GridViewTrait |
$rowOptions | array|Closure | The HTML attributes for the table body rows. | yii\grid\GridView |
$selectedColumns | array | The selected column indexes for export. | kartik\export\ExportMenu |
$sheetName | string | The sheet name. | kartik\export\ExportMenu |
$showColumnSelector | boolean | Whether to show a column selector to select columns for export. | kartik\export\ExportMenu |
$showConfirmAlert | boolean | Whether to show a confirmation alert dialog before download. | kartik\export\ExportMenu |
$showFooter | boolean | Whether to show the footer section of the grid table. | yii\grid\GridView |
$showHeader | boolean | Whether to show the header section of the grid table. | yii\grid\GridView |
$showOnEmpty | boolean | Whether to show the grid view if $dataProvider returns no data. | yii\grid\GridView |
$showPageSummary | boolean | Whether to show the page summary row for the table. | kartik\grid\GridViewTrait |
$sorter | array | The configuration for the sorter widget. | yii\widgets\BaseListView |
$sorterIcons | array | The configuration for sorter icons. | kartik\grid\GridViewTrait |
$stack | yii\base\Widget[] | The widgets that are currently being rendered (not ended). | yii\base\Widget |
$stream | boolean | Whether to stream output to the browser. | kartik\export\ExportMenu |
$stripHtml | boolean | Whether to strip HTML tags from each of the source column data before rendering the PHP Spreadsheet Cell. | kartik\export\ExportMenu |
$striped | boolean | Whether the grid will have a striped style. |
kartik\grid\GridViewTrait |
$styleOptions | array | The output style configuration options for each data cell. | kartik\export\ExportMenu |
$summary | string | The HTML content to be displayed as the summary of the list view. | yii\widgets\BaseListView |
$summaryOptions | array | The HTML attributes for the summary of the list view. | yii\widgets\BaseListView |
$supplementSheets | array|null | New supplement sheets to be created. | kartik\export\ExportMenu |
$tableOptions | array | The HTML attributes for the grid table element. | yii\grid\GridView |
$target | string | The target for submitting the export form, which will trigger the download of the exported file. | kartik\export\ExportMenu |
$template | \kartik\export\string, | The template for rendering the content in the container. | kartik\export\ExportMenu |
$timeout | integer | Timeout for the export function (in seconds), if timeout is < 0, the default PHP timeout will be used. | kartik\export\ExportMenu |
$toggleData | boolean | Whether to enable toggling of grid data. | kartik\grid\GridViewTrait |
$toggleDataContainer | array | The HTML attributes for the toggle data button group container. | kartik\grid\GridViewTrait |
$toggleDataOptions | array | The settings for the toggle data button for the toggle data type. | kartik\grid\GridViewTrait |
$toolbar | array|string | The toolbar content configuration. | kartik\grid\GridViewTrait |
$toolbarContainerOptions | array | The HTML attributes for the toolbar container. | kartik\grid\GridViewTrait |
$triggerDownload | boolean | Flag to identify if download is triggered | kartik\export\ExportMenu |
$view | yii\web\View | The view object that can be used to render views or view files. Note that the type of this property differs in getter and setter. See getView() and setView() for details. | yii\base\Widget |
$viewPath | string | The directory containing the view files for this widget. | yii\base\Widget |
$visibleColumns | array | The columns configuration | kartik\export\ExportMenu |
Protected Properties
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\Component |
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
__construct() | Constructor. | yii\base\BaseObject |
__get() | Returns the value of a component property. | yii\base\Component |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\Component |
__set() | Sets the value of a component property. | yii\base\Component |
__unset() | Sets a component property to be null. | yii\base\Component |
addCssClass() | Adds bootstrap CSS class to options by parsing the bootstrap version for the specified Bootstrap CSS type. | kartik\base\BootstrapTrait |
afterRun() | This method is invoked right after a widget is executed. | yii\base\Widget |
attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
beforeRun() | This method is invoked right before the widget is executed. | yii\base\Widget |
begin() | Begins a widget. | yii\base\Widget |
behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
className() | Returns the fully qualified name of this class. | yii\base\BaseObject |
columnName() | Returns an excel column name. | kartik\export\ExportMenu |
createSupplementSheets() | Create supplement sheets, usually from dropDownList used by gridView. Needed for using dataValidation. | kartik\export\ExportMenu |
destroyPhpSpreadsheet() | Destroys PhpSpreadsheet Object Instance | kartik\export\ExportMenu |
detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
end() | Ends a widget. | yii\base\Widget |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
generateAfterContent() | Generates the after content at the bottom of the exported sheet | kartik\export\ExportMenu |
generateBeforeContent() | Generates the before content at the top of the exported sheet | kartik\export\ExportMenu |
generateBody() | Generates the output data body content. | kartik\export\ExportMenu |
generateFooter() | Generates the output footer row after a specific row number | kartik\export\ExportMenu |
generateHeader() | Generates the output data header content. | kartik\export\ExportMenu |
generateRow() | Generates an output data row with the given data model and key. | kartik\export\ExportMenu |
getBSClass() | Gets the respective Bootstrap class based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
getBehavior() | Returns the named behavior object. | yii\base\Component |
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
getBsVer() | Gets the current set bootstrap version number. | kartik\base\BootstrapTrait |
getColumnHeader() | Gets the column header content | kartik\export\ExportMenu |
getCssClass() | Gets bootstrap css class by parsing the bootstrap version for the specified BS CSS type. | kartik\base\BootstrapTrait |
getDefaultBtnCss() | Gets the default button CSS | kartik\base\BootstrapTrait |
getDefaultIconPrefix() | Gets the default icon css prefix | kartik\base\BootstrapTrait |
getDefaultSorterIcons() | Gets default sorter icons | kartik\grid\GridViewTrait |
getDropdownClass() | Gets the respective bootstrap dropdown class name based on currently configured bootstrap version. | kartik\base\BootstrapTrait |
getExportType() | Gets the currently selected export type | kartik\export\ExportMenu |
getId() | Returns the ID of the widget. | yii\base\Widget |
getPhpSpreadsheet() | Gets the PhpSpreadsheet object | kartik\export\ExportMenu |
getPhpSpreadsheetWorksheet() | Gets the PhpSpreadsheet sheet object | kartik\export\ExportMenu |
getPhpSpreadsheetWriter() | Gets the PhpSpreadsheet writer object | kartik\export\ExportMenu |
getPjaxContainerId() | Get pjax container identifier | kartik\grid\GridViewTrait |
getView() | Returns the view object that can be used to render views or view files. | yii\base\Widget |
getViewPath() | Returns the directory containing the view files for this widget. | yii\base\Widget |
getVisibleColumns() | Gets the visible columns for export | kartik\export\ExportMenu |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
init() | Initializes the grid view. | kartik\export\ExportMenu |
initExport() | Initializes export settings | kartik\export\ExportMenu |
initI18N() | Yii i18n messages configuration for generating translations | kartik\base\TranslationTrait |
initPhpSpreadsheet() | Initializes PhpSpreadsheet Object Instance | kartik\export\ExportMenu |
initPhpSpreadsheetWorksheet() | Initializes PhpSpreadsheet Worksheet Instance | kartik\export\ExportMenu |
initPhpSpreadsheetWriter() | Initializes PhpSpreadsheet Writer Object Instance | kartik\export\ExportMenu |
initPjaxContainerId() | Initializes pjax container identifier | kartik\grid\GridViewTrait |
isBs() | Validate Bootstrap version | kartik\base\BootstrapTrait |
isBs4() | Validate if Bootstrap 4.x version. | kartik\base\BootstrapTrait |
off() | Detaches an existing event handler from this component. | yii\base\Component |
on() | Attaches an event handler to an event. | yii\base\Component |
parseKey() | Parses the key and returns parsed key value as string based on the data type | kartik\grid\GridViewTrait |
removeCssClass() | Removes bootstrap CSS class from options by parsing the bootstrap version for the specified Bootstrap CSS type. | kartik\base\BootstrapTrait |
render() | Renders a view. | yii\base\Widget |
renderCaption() | Renders the caption element. | yii\grid\GridView |
renderColumnGroup() | Renders the column group HTML. | yii\grid\GridView |
renderColumnSelector() | Renders the columns selector | kartik\export\ExportMenu |
renderEmpty() | Renders the HTML content indicating that the list view has no data. | yii\widgets\BaseListView |
renderErrors() | Renders validator errors of filter model. | yii\grid\GridView |
renderExport() | Renders the export menu. | kartik\grid\GridViewTrait |
renderExportMenu() | Renders the export menu | kartik\export\ExportMenu |
renderFile() | Renders a view file. | yii\base\Widget |
renderFilters() | Renders the filter. | yii\grid\GridView |
renderItems() | Renders the data models for the grid view. | yii\grid\GridView |
renderPageSummary() | Renders the table page summary. | kartik\grid\GridViewTrait |
renderPager() | Renders the pager. | yii\widgets\BaseListView |
renderSection() | Renders a section of the specified name. | yii\grid\GridView |
renderSorter() | Renders the sorter. | yii\widgets\BaseListView |
renderSummary() | Renders the summary text. | kartik\grid\GridView |
renderTableBody() | Renders the table body. | yii\grid\GridView |
renderTableFooter() | Renders the table footer. | yii\grid\GridView |
renderTableHeader() | Renders the table header. | yii\grid\GridView |
renderTableRow() | Renders a table row with the given data model and key. | kartik\grid\GridViewTrait |
renderToggleData() | Renders the toggle data button. | kartik\grid\GridViewTrait |
run() | Runs the widget. | kartik\export\ExportMenu |
sanitize() | Sanitizes file name | kartik\export\ExportMenu |
setDataValidation() | Excel Data Validation (dropDownList in excel). Requires supplementSheets . |
kartik\export\ExportMenu |
setId() | Sets the ID of the widget. | yii\base\Widget |
setPhpSpreadsheet() | Sets the PhpSpreadsheet object | kartik\export\ExportMenu |
setPhpSpreadsheetWorksheet() | Sets the PhpSpreadsheet sheet object | kartik\export\ExportMenu |
setPhpSpreadsheetWriter() | Sets the PhpSpreadsheet writer object | kartik\export\ExportMenu |
setView() | Sets the view object to be used by this widget. | yii\base\Widget |
setVisibleColumns() | Sets visible columns for export | kartik\export\ExportMenu |
slash() | Appends slash to path if it does not exist | kartik\export\ExportMenu |
trigger() | Triggers an event. | yii\base\Component |
widget() | Creates a widget instance and runs it. | yii\base\Widget |
Protected Methods
Method | Description | Defined By |
---|---|---|
autoFormat() | Autoformats a cell by auto detecting the grid column alignment and format | kartik\export\ExportMenu |
beginPjax() | Begins the pjax widget rendering | kartik\grid\GridViewTrait |
checkGroupedRow() | Validates a grouped row | kartik\export\ExportMenu |
cleanup() | Cleans up the export file and current object instance | kartik\export\ExportMenu |
clearOutputBuffers() | Clear output buffers | kartik\export\ExportMenu |
configureBsVersion() | Configures the bootstrap version settings | kartik\base\BootstrapTrait |
createDataColumn() | Creates a yii\grid\DataColumn object based on a string in the format of "attribute:format:label". | yii\grid\GridView |
endPjax() | Completes the pjax widget rendering | kartik\grid\GridViewTrait |
findGroupedColumn() | Search all groupable columns | kartik\export\ExportMenu |
genToggleDataScript() | Generate toggle data client validation script. | kartik\grid\GridViewTrait |
generateBox() | Generates the box | kartik\export\ExportMenu |
generateGroupedRow() | Generate a grouped row | kartik\export\ExportMenu |
generateRows() | Generate HTML markup for additional table rows for header and/or footer. | kartik\grid\GridViewTrait |
getAttributeLabel() | Generates the attribute label | kartik\export\ExportMenu |
getBsExtBasename() | The yii2-bootstrap extension base name. | kartik\base\BootstrapTrait |
getClientOptions() | Returns the options for the grid view JS widget. | yii\grid\GridView |
getColumnLabel() | Fetches the column label | kartik\export\ExportMenu |
getPageSummaryRow() | Get the page summary row markup | kartik\grid\GridViewTrait |
getSetting() | Gets the setting property value for the current export format | kartik\export\ExportMenu |
getStyleOpts() | Parses and returns the style options for contentBefore or contentAfter |
kartik\export\ExportMenu |
guessColumns() | This function tries to guess the columns to show from the given data if $columns are not explicitly specified. | yii\grid\GridView |
initBootstrapStyle() | Initialize bootstrap specific styling. | kartik\grid\GridViewTrait |
initBsVersion() | Initializes bootstrap versions for the widgets and asset bundles. | kartik\base\BootstrapTrait |
initColumnSelector() | Initialize column selector list | kartik\export\ExportMenu |
initColumns() | Creates column objects and initializes them. | yii\grid\GridView |
initCss() | Sets a default css class within options if not set |
kartik\grid\GridViewTrait |
initEditedRow() | kartik\grid\GridViewTrait | |
initGridView() | Initializes the Krajee GridView widget | kartik\grid\GridViewTrait |
initLayout() | Initialize the grid layout. | kartik\grid\GridViewTrait |
initModule() | Initialize the module based on module identifier | kartik\grid\GridViewTrait |
initPanel() | Initializes and sets the grid panel layout based on the template and $panel settings. | kartik\grid\GridViewTrait |
initSelectedColumns() | Initialize columns selected for export | kartik\export\ExportMenu |
initSettings() | Initialize export menu settings | kartik\export\ExportMenu |
initToggleData() | Initialize toggle data button options. | kartik\grid\GridViewTrait |
isSameVersion() | Compares two versions and checks if they are of the same major BS version. | kartik\base\BootstrapTrait |
parseExportConfig() | Parses export configuration and returns the merged defaults. | kartik\grid\GridViewTrait |
parseVer() | Parses and returns the major BS version | kartik\base\BootstrapTrait |
prepareGridView() | Prepares the Krajee GridView widget for run | kartik\grid\GridViewTrait |
raiseEvent() | Raises a callable event | kartik\export\ExportMenu |
registerAssets() | Registers client assets needed for Export Menu widget | kartik\export\ExportMenu |
renderTablePart() | Renders the table header or footer part | kartik\grid\GridViewTrait |
renderToolbar() | Generates the toolbar. | kartik\grid\GridViewTrait |
renderToolbarContainer() | Generates the toolbar container with the toolbar | kartik\grid\GridViewTrait |
replaceLayoutTokens() | Replace layout tokens | kartik\grid\GridViewTrait |
setDefaultExportConfig() | Sets the default export configuration | kartik\export\ExportMenu |
setDefaultStyles() | Sets default styles | kartik\export\ExportMenu |
setHttpHeaders() | Set HTTP headers for download | kartik\export\ExportMenu |
setOutCellValue() | Parses format and sets the value of a PHP Spreadsheet Cell | kartik\export\ExportMenu |
setPagerOptionClass() | Adds CSS class to the pager parameter | kartik\grid\GridViewTrait |
Events
Event | Type | Description | Defined By |
---|---|---|---|
EVENT_AFTER_RUN | yii\base\WidgetEvent | An event raised right after executing a widget. (available since version 2.0.11) | yii\base\Widget |
EVENT_BEFORE_RUN | yii\base\WidgetEvent | An event raised right before executing a widget. (available since version 2.0.11) | yii\base\Widget |
EVENT_INIT | yii\base\Event | An event that is triggered when the widget is initialized via init(). (available since version 2.0.11) | yii\base\Widget |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
ENCODING_UTF8 | 'utf-8' | kartik\export\ExportMenu | |
FILTER_POS_BODY | 'body' | yii\grid\GridView | |
FILTER_POS_FOOTER | 'footer' | yii\grid\GridView | |
FILTER_POS_HEADER | 'header' | yii\grid\GridView | |
FORMAT_CSV | 'Csv' | kartik\export\ExportMenu | |
FORMAT_EXCEL | 'Xls' | kartik\export\ExportMenu | |
FORMAT_EXCEL_X | 'Xlsx' | kartik\export\ExportMenu | |
FORMAT_HTML | 'Html' | kartik\export\ExportMenu | |
FORMAT_PDF | 'Pdf' | kartik\export\ExportMenu | |
FORMAT_TEXT | 'Txt' | kartik\export\ExportMenu | |
TARGET_BLANK | '_blank' | kartik\export\ExportMenu | |
TARGET_IFRAME | '_iframe' | kartik\export\ExportMenu | |
TARGET_POPUP | '_popup' | kartik\export\ExportMenu | |
TARGET_SELF | '_self' | kartik\export\ExportMenu |
Property Details
The table beginning row
Whether the column selector is enabled
The default export configuration
The current table end column
The current table end row
Columns to be grouped
Grouped row values
The header beginning row
Object instance
Object instance
Object instance
The modified data provider for usage with export.
The visble columns for export
The view file to show details of exported file link. This property will be validated only when
$stream is false
. You can set this to false
to not display any file link details for view. This defaults
to the _view
PHP file in the views
folder of the extension.
Whether to render the export menu as bootstrap button dropdown widget. Defaults to true
. If set to
false
, this will generate a simple HTML list of links.
Whether to auto-size the excel output column widths. Defaults to true
.
Fetch models from the dataprovider using batches of this size. Set this to 0
(the default) to
disable. If $dataProvider
does not have a pagination object, this parameter is ignored. Setting this
property helps reduce memory overflow issues by allowing parsing of models in batches, rather than fetching
all models in one go.
The output style configuration options for the entire spreadsheet box range. It must be the style
configuration array as required by \PhpOffice\PhpSpreadsheet\Spreadsheet
.
Whether to clear all previous / parent buffers. Defaults to false
.
The column selector flag parameter for export form
The settings for the toggle all checkbox to check / uncheck the columns as a batch. Should be setup as an associative array which can have the following keys:
show
: boolean, whether the batch toggle checkbox is to be shown. Defaults totrue
.label
: string, the label to be displayed for toggle all. Defaults toSelect Columns
.options
: array, the HTML attributes for the toggle label text. Defaults to['class'=>'kv-toggle-all']
The configuration of the column names in the column selector. Note: column names will be generated
automatically by default. Any setting in this property will override the auto-generated column names. This
list should be setup as $key => $value
where:
$key
: integer, is the zero based index of the column as set in$columns
.$value
: string, is the column name/label you wish to display in the column selector.
The HTML attributes for the column selector menu list.
The HTML attributes for the column selector dropdown button. The following special options are recognized:
label
: string, defaults to empty string.icon
: string, defaults to<i class="glyphicon glyphicon-list"></i>
for BS3 and<i class="fas fa-list"></i>
for BS4title
: string, defaults toSelect columns for export
.
HTML attributes for the container to wrap the widget. Defaults to:
['class'=>'btn-group', 'role'=>'group']
An array of rows to append after the footer row. Each array should be set with the following settings:
- value: string, the value of the merged row
- cellFormat: string|null, the explicit cell format to apply (should be one of the
PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_
constants) - styleOptions: array, array of configuration options to set the style. See $styleOptions on how to configure.
An array of rows to prepend in front of the grid used to create things like a title. Each array should be set with the following settings:
- value: string, the value of the merged row
- cellFormat: string|null, the explicit cell format to apply (should be one of the
PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_
constants) - styleOptions: array, array of configuration options to set the style. See $styleOptions on how to configure.
Data for creating excel data validation. An example setting:
'dataValidation' => ['sheetName1' => ['cellPosition' => count($array)], 'sheetName2' => []],
If set to empty or null will be ignored.
Whether to delete file after saving file to $folder and when $stream is false
. This property
will be validated only when $stream is false
.
The column indexes for export that will be disabled for selection in the column selector.
The \PhpOffice\PhpSpreadsheet\Spreadsheet document properties
The HTML attributes for the export button menu. Applicable only if $asDropdown is set to true
.
The following special options are available:
label
: string, defaults to empty stringicon
: string, defaults to<i class="glyphicon glyphicon-export"></i>
for BS3 and<i class="fas fa-external-link-alt"></i>
for BS4title
: string, defaults toExport data in selected format
.menuOptions
: array, the HTML attributes for the dropdown menu.itemsBefore
: array, any additional items that will be merged/prepended before with the export dropdown list. This should be similar to theitems
property as supported by ButtonDropdown widget. Note the page export items will be automatically generated based on settings in the $exportConfig property.itemsAfter
: array, any additional items that will be merged/appended after with the export dropdown list. This should be similar to theitems
property as supported by ButtonDropdown widget. Note the page export items will be automatically generated based on settings in theexportConfig
property.
Enable dynagrid for column selection. If set to true
the inbuilt export menu column selector
functionality will be disabled and not rendered and column settings for dynagrid will be used as per settings
configured in $dynagridOptions.
Dynagrid widget options. Applicable only if $dynagrid is set to true
.
Enable or disable cell formatting by auto detecting the grid column alignment and format.
If set to false
the format will not be applied but improve performance configured in $dynagridOptions.
Whether to enable the yii gridview formatter component. Defaults to true
. If set to false
, this
will render content as raw
format.
Encoding for the downloaded file header. Defaults to ENCODING_UTF8.
The export columns input parameter for export form
The view file for rendering the columns selection
The export configuration. The array keys must be the one of the format
constants (CSV, HTML, TEXT,
EXCEL, PDF) and the array value is a configuration array consisting of these settings:
label
: string, the label for the export format menu item displayedicon
: string, the glyphicon or font-awesome name suffix to be displayed before the export menu item label. If set to an empty string_, this will not be displayed.iconOptions
: array, HTML attributes for export menu icon.linkOptions
: array, HTML attributes for each export item link.filename
: string, the base file name for the generated file. Defaults to 'grid-export'. This will be used to generate a default file name for downloading.extension
: string, the extension for the file namealertMsg
: string, the message prompt to show before saving. If this is empty or not set it will not be displayed.mime
: string, the mime type (for the file format) to be set before downloading.writer
: string, the PhpSpreadsheet writer typeoptions
: array, HTML attributes for the export menu item.
The configuration of additional hidden inputs that will be rendered with the export form. This will be
set as an array of hidden input $name => $setting
pairs where:
$name
: string, is the hidden input name attribute.$setting
: array, containing the following settings:value
: string, the value of the hidden input. Defaults to NULL.options
: array, the HTML attributes for the hidden input. Defaults to an empty array[]
.
An example of how you can configure this property is shown below:
[
'inputName1' => ['value' => 'inputValue1'],
'inputName2' => ['value' => 'inputValue2', 'options' => ['id' => 'inputId2']],
]
The HTML attributes for the export form.
The view file for rendering the export form. DEPRECATED since v1.3.5 (not parsed or used anymore).
The request parameter ($_GET or $_POST) that will be submitted during export. If not set this will be auto generated. This should be unique for each export menu widget (for multiple export menu widgets on same page).
The data output format type. Defaults to ExportMenu::FORMAT_EXCEL_X
.
The export type input parameter for export form
The exported output file name. Defaults to 'grid-export';
The folder to save the exported file. Defaults to '@app/runtime/export/'. If the specified folder does not exist, the extension will attempt to create it - else an exception will be thrown.
Whether to use font awesome icons for rendering the icons as defined in $exportConfig. If set to
true
, you must load the FontAwesome CSS separately in your application.
The PhpSpreadsheet style configuration for a grouped grid row
'font' => ['bold' => false, 'color' => ['argb' => \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKBLUE]], 'fill' => ['type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'color' => ['argb' => \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_WHITE]]]
The output style configuration options for the header row. It must be the style configuration array as
required by \PhpOffice\PhpSpreadsheet\Spreadsheet
.
The column indexes for export that will be hidden for selection in the column selector, but will still be displayed in export output.
Whether to initialize data provider and clear models before rendering. Defaults to false
.
Configuration settings for the Krajee dialog widget that will be used to render alerts and confirmation dialog prompts
See also http://demos.krajee.com/dialog.
The name of the file to be appended to $linkPath to generate the complete link. If not set, this will default to the $filename.
The web accessible path for the saved file location. This property will be parsed only if $stream is false. Note the $afterSaveView property that will render the displayed file link.
The configuration of various messages that will be displayed at runtime:
- allowPopups: string, the message to be shown to disable browser popups for download. Defaults to
Disable any popup blockers in your browser to ensure proper download.
. - confirmDownload: string, the message to be shown for confirming to proceed with the download. Defaults to
Ok to proceed?
. - downloadProgress: string, the message to be shown in a popup dialog when download request is executed.
Defaults to
Generating file. Please wait...
. - downloadComplete: string, the message to be shown in a popup dialog when download request is completed.
Defaults to
All done! Click anywhere here to close this window, once you have downloaded the file.
.
The column indexes for export that will not be exported at all nor will they be shown in the column selector
The callback function to be executed after the output file is generated. This function must return
a boolean status of true
or false
. A false
status will abort the post file generation activities. The
anonymous function should have the following signature:
`
php
function ($fileExt, $widget)
`
where:
$fileExt
: string, is the generated file extension.$widget
: ExportMenu, the current ExportMenu object instance
The callback function on initializing the PhpSpreadsheet library. The anonymous function should have the
following signature:
`
php
function ($spreadsheet, $widget)
`
where:
$spreadsheet
: \PhpOffice\PhpSpreadsheet\Spreadsheet, the Spreadsheet object instance$widget
: ExportMenu, the current ExportMenu object instance
The callback function to be executed on initializing the active sheet. The anonymous function
should have the following signature:
`
php
function ($sheet, $widget)
`
where:
$sheet
: \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet, the Worksheet object instance$widget
: ExportMenu, the current ExportMenu object instance
The callback function on initializing the writer. The anonymous function should have the following
signature:
`
php
function ($writer, $widget)
`
where:
$writer
: \PhpOffice\PhpSpreadsheet\Writer\BaseWriter, the BaseWriter object instance$widget
: ExportMenu, the current ExportMenu object instance
The callback function to be executed on rendering each body data cell content. The anonymous
function should have the following signature:
`
php
function ($cell, $content, $model, $key, $index, $widget)
`
where:
$cell
: \PhpOffice\PhpSpreadsheet\Cell\Cell, the current Spreadsheet cell being rendered$content
: string, the data cell content being rendered$model
: Model, the data model to be rendered$key
: mixed, the key associated with the data model$index
: integer, the zero-based index of the data model among the model array returned by $dataProvider.$widget
: ExportMenu, the current ExportMenu object instance
The callback function to be executed on rendering the footer cell output content. The anonymous
function should have the following signature:
`
php
function ($cell, $content, $widget)
`
where:
$sheet
: \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet, the Worksheet object instance$content
: string, the footer cell content being rendered$widget
: ExportMenu, the current ExportMenu object instance
The callback function to be executed on rendering the header cell output content. The anonymous
function should have the following signature:
`
php
function ($cell, $content, $widget)
`
where:
$cell
: \PhpOffice\PhpSpreadsheet\Cell\Cell, is the current Spreadsheet cell being rendered$content
: string, is the header cell content being rendered$widget
: ExportMenu, the current ExportMenu object instance
The callback function to be executed on rendering the sheet. The anonymous function should have the
following signature:
`
php
function ($sheet, $widget)
`
where:
$sheet
: \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet, the Worksheet object instance$widget
: ExportMenu, the current ExportMenu object instance
The current \PhpOffice\PhpSpreadsheet\Spreadsheet object instance
public void setPhpSpreadsheet ( \PhpOffice\PhpSpreadsheet\Spreadsheet $obj )
The current \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance
public void setPhpSpreadsheetWorksheet ( $obj )
The current \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance
public void setPhpSpreadsheetWriter ( $obj )
The pjax container identifier inside which this menu is being rendered. If set the jQuery export menu plugin will get auto initialized on pjax request completion.
The selected column indexes for export. If not set this will default to all columns.
The sheet name. Defaults to 'Worksheet'.
Whether to show a column selector to select columns for export. Defaults to true
.
This is applicable only if $asDropdown is set to true
. Else this property is ignored.
Whether to show a confirmation alert dialog before download. This confirmation dialog will notify
user about the type of exported file for download and to disable popup blockers. Defaults to true
.
Whether to stream output to the browser.
Whether to strip HTML tags from each of the source column data before rendering the PHP Spreadsheet Cell.
The output style configuration options for each data cell. It must be the style configuration
array as required by \PhpOffice\PhpSpreadsheet\Spreadsheet
.
New supplement sheets to be created. Required for data validation in excel. An example setting:
'supplementSheets' => ['city' => $citiesKeyValueArray, 'state' => $stateKeyValueArray],
If set to empty or null will be ignored.
The target for submitting the export form, which will trigger the download of the exported file.
Must be one of the TARGET_
constants. Defaults to TARGET_SELF. Note if you set $stream to false
,
then this will be always overridden to TARGET_SELF.
The template for rendering the content in the container. This will be parsed only if asDropdown
is true
. The following tokens will be replaced:
{columns}
: will be replaced with the column selector dropdown{menu}
: will be replaced with export menu dropdown
Timeout for the export function (in seconds), if timeout is < 0, the default PHP timeout will be used.
Flag to identify if download is triggered
The columns configuration
Method Details
Autoformats a cell by auto detecting the grid column alignment and format
protected void autoFormat ( $model, $key, $index, $column, $cell ) | ||
$model | mixed | The data model to be rendered |
$key | mixed | The key associated with the data model |
$index | integer | The zero-based index of the data model among the model array returned by $dataProvider. |
$column | yii\grid\Column | |
$cell | \PhpOffice\PhpSpreadsheet\Cell\Cell | |
throws | \PhpOffice\PhpSpreadsheet\Exception|\Exception |
---|
Validates a grouped row
protected void checkGroupedRow ( $model, $nextModel, $key, $index ) | ||
$model | yii\base\Model|array | The data model |
$nextModel | yii\base\Model|array | The next data model |
$key | integer | The key associated with the data model |
$index | integer | The zero-based index of the data model among the model array returned by $dataProvider. |
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Cleans up the export file and current object instance
protected void cleanup ( $file, $config ) | ||
$file | string | The file exported |
$config | array | The export configuration |
Clear output buffers
protected void clearOutputBuffers ( ) |
Returns an excel column name.
public static string columnName ( $index ) | ||
$index | integer | The column index number |
Create supplement sheets, usually from dropDownList used by gridView. Needed for using dataValidation.
public void createSupplementSheets ( ) | ||
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Destroys PhpSpreadsheet Object Instance
public void destroyPhpSpreadsheet ( ) |
Search all groupable columns
protected void findGroupedColumn ( ) |
Generates the after content at the bottom of the exported sheet
public void generateAfterContent ( $row ) | ||
$row | integer | The row number after which the content is to be generated |
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Generates the before content at the top of the exported sheet
public void generateBeforeContent ( ) | ||
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Generates the output data body content.
public integer generateBody ( ) | ||
return | integer | The number of output rows. |
---|---|---|
throws | \PhpOffice\PhpSpreadsheet\Exception |
Generates the box
protected void generateBox ( ) |
Generates the output footer row after a specific row number
public integer generateFooter ( ) | ||
return | integer | The row number after which the footer is to be generated |
---|---|---|
throws | \PhpOffice\PhpSpreadsheet\Exception |
Generate a grouped row
protected void generateGroupedRow ( $groupFooter, $groupedCol ) | ||
$groupFooter | array | Footer row |
$groupedCol | integer | The zero-based index of grouped column |
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Generates the output data header content.
public void generateHeader ( ) | ||
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Generates an output data row with the given data model and key.
public void generateRow ( $model, $key, $index ) | ||
$model | mixed | The data model to be rendered |
$key | mixed | The key associated with the data model |
$index | integer | The zero-based index of the data model among the model array returned by $dataProvider. |
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Generates the attribute label
protected string getAttributeLabel ( $attribute ) | ||
$attribute | string |
Gets the column header content
public string getColumnHeader ( $col ) | ||
$col | yii\grid\DataColumn |
Fetches the column label
protected string getColumnLabel ( $key, $column ) | ||
$key | integer | |
$column | yii\grid\Column |
Gets the currently selected export type
public string getExportType ( ) |
Gets the PhpSpreadsheet object
public \PhpOffice\PhpSpreadsheet\Spreadsheet getPhpSpreadsheet ( ) | ||
return | \PhpOffice\PhpSpreadsheet\Spreadsheet | The current \PhpOffice\PhpSpreadsheet\Spreadsheet object instance |
---|
Gets the PhpSpreadsheet sheet object
public \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet getPhpSpreadsheetWorksheet ( ) | ||
return | \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet | The current \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance |
---|
Gets the PhpSpreadsheet writer object
public \PhpOffice\PhpSpreadsheet\Writer\BaseWriter getPhpSpreadsheetWriter ( ) | ||
return | \PhpOffice\PhpSpreadsheet\Writer\BaseWriter | The current \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance |
---|
Gets the setting property value for the current export format
protected mixed getSetting ( $key, $default = null ) | ||
$key | string | The setting property key for the current export format |
$default | string | The default value for the property |
throws | Exception |
---|
Parses and returns the style options for contentBefore
or contentAfter
protected array getStyleOpts ( $settings = [] ) | ||
$settings | array | The settings to parse (for |
throws | Exception |
---|
Gets the visible columns for export
public array getVisibleColumns ( ) | ||
return | array | The columns configuration |
---|
Initializes the grid view.
This method will initialize required property values and instantiate $columns objects.
public void init ( ) |
Initialize column selector list
protected void initColumnSelector ( ) |
Initializes export settings
public void initExport ( ) |
Initializes PhpSpreadsheet Object Instance
public void initPhpSpreadsheet ( ) |
Initializes PhpSpreadsheet Worksheet Instance
public void initPhpSpreadsheetWorksheet ( ) |
Initializes PhpSpreadsheet Writer Object Instance
public void initPhpSpreadsheetWriter ( $type ) | ||
$type | string | The writer type as set in export config |
throws | \PhpOffice\PhpSpreadsheet\Writer\Exception |
---|
Initialize columns selected for export
protected void initSelectedColumns ( ) |
Initialize export menu settings
protected void initSettings ( ) |
Raises a callable event
protected mixed raiseEvent ( $event, $params ) | ||
$event | string | The event name |
$params | array | The parameters to the callable function |
Registers client assets needed for Export Menu widget
protected void registerAssets ( ) | ||
throws | \Exception|\Throwable |
---|
Renders the columns selector
public string renderColumnSelector ( ) | ||
return | string | The column selector markup |
---|---|---|
throws | Exception |
Renders the export menu
public string renderExportMenu ( ) | ||
return | string | The export menu markup |
---|---|---|
throws | yii\base\InvalidConfigException | |
throws | \Exception|\Throwable |
Runs the widget.
public void run ( ) |
Sanitizes file name
public static string sanitize ( $string ) | ||
$string | string | |
throws | Exception |
---|
Excel Data Validation (dropDownList in excel). Requires supplementSheets
.
public void setDataValidation ( $sheetName, $cell, $length ) | ||
$sheetName | string | |
$cell | integer|string | |
$length | integer | |
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Sets the default export configuration
protected void setDefaultExportConfig ( ) | ||
throws | \yii\base\InvalidConfigException|\Exception |
---|
Sets default styles
protected void setDefaultStyles ( $section ) | ||
$section | string | The php spreadsheet section |
Set HTTP headers for download
protected void setHttpHeaders ( ) |
Parses format and sets the value of a PHP Spreadsheet Cell
protected \PhpOffice\PhpSpreadsheet\Cell\Cell setOutCellValue ( $sheet, $index, $value, $format = null ) | ||
$sheet | \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet | |
$index | string | Coordinate of the cell, eg: 'A1' |
$value | mixed | Value of the cell |
$format | string|null | The explicit cell format to apply (should be one of the |
throws | \PhpOffice\PhpSpreadsheet\Exception |
---|
Sets the PhpSpreadsheet object
public void setPhpSpreadsheet ( \PhpOffice\PhpSpreadsheet\Spreadsheet $obj ) | ||
$obj | Spreadsheet the \PhpOffice\PhpSpreadsheet\Spreadsheet object instance |
Sets the PhpSpreadsheet sheet object
public void setPhpSpreadsheetWorksheet ( $obj ) | ||
$obj | Worksheet the \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet object instance |
Sets the PhpSpreadsheet writer object
public void setPhpSpreadsheetWriter ( $obj ) | ||
$obj | BaseWriter the \PhpOffice\PhpSpreadsheet\Writer\BaseWriter object instance |
Sets visible columns for export
public void setVisibleColumns ( ) |
Appends slash to path if it does not exist
public static string slash ( $path, $s = DIRECTORY_SEPARATOR ) | ||
$path | string | |
$s | string | The path separator |