Skip to content

Adds hidden columns functionality#932

Merged
michelebastione merged 2 commits intomini-software:masterfrom
michelebastione:hidden-columns
Mar 9, 2026
Merged

Adds hidden columns functionality#932
michelebastione merged 2 commits intomini-software:masterfrom
michelebastione:hidden-columns

Conversation

@michelebastione
Copy link
Contributor

Resolves #660.
The new MiniExcelHiddenAttribute and property MiniExcelColumnAttribute.Hidden now allow for a property or field to be mapped to a hidden column in Excel's UI.

The new `MiniExcelHiddenAttribute` and property `MiniExcelColumnAttribute.Hidden` now allow for columns to be hidden from Excel's UI when mapped.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the MiniExcel library by adding robust support for hidden columns. It allows developers to easily control the visibility of columns in generated Excel spreadsheets through new attributes, improving the flexibility and presentation of exported data. The changes integrate seamlessly with the existing attribute-based configuration system.

Highlights

  • Hidden Column Functionality: Introduced the ability to mark columns as hidden in generated Excel files using new attributes.
  • New Attributes: Added a dedicated MiniExcelHiddenAttribute and a Hidden property to the existing MiniExcelColumnAttribute for specifying column visibility.
  • Documentation Updates: Updated the README-V2.md to include examples demonstrating how to use the new hidden column features.
  • Internal Property Renaming: Renamed the internal ExcelIgnore property to ExcelIgnoreColumn in MiniExcelColumnMapping for better clarity and consistency.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README-V2.md
    • Added a new section 'Set Column Visibility' with an example demonstrating the use of [MiniExcelHidden] attribute.
    • Updated the MiniExcelColumnAttribute example to include the Hidden = true property.
  • src/MiniExcel.Core/Attributes/MiniExcelColumnAttribute.cs
    • Added a new Hidden boolean property to the MiniExcelColumnAttribute.
  • src/MiniExcel.Core/Attributes/MiniExcelHiddenAttribute.cs
    • Created a new MiniExcelHiddenAttribute class to specifically mark properties as hidden.
  • src/MiniExcel.Core/Reflection/ColumnMappingsProvider.cs
    • Integrated the MiniExcelHiddenAttribute and MiniExcelColumnAttribute.Hidden into the column mapping process to determine ExcelHiddenColumn.
    • Updated references from ExcelIgnore to ExcelIgnoreColumn when processing dynamic column configurations.
  • src/MiniExcel.Core/Reflection/MiniExcelColumnMapping.cs
    • Introduced a new ExcelHiddenColumn boolean property.
    • Renamed the ExcelIgnore property to ExcelIgnoreColumn.
  • src/MiniExcel.Core/WriteAdapters/DataReaderWriteAdapter.cs
    • Modified the column filtering condition to use ExcelIgnoreColumn instead of ExcelIgnore.
  • src/MiniExcel.OpenXml/Constants/WorksheetXml.cs
    • Updated the Column static method to accept an optional hidden boolean parameter for generating the Excel column XML.
    • Adjusted the MaxColumnLength calculation to account for the new hidden attribute in the column XML string.
  • src/MiniExcel.OpenXml/Models/ExcelColumnWidth.cs
    • Added a hidden boolean parameter to the constructor of ExcelColumnWidth.
    • Introduced a Hidden boolean property to the ExcelColumnWidth class.
    • Modified the GetFromMappings method to consider ExcelHiddenColumn when creating ExcelColumnWidth objects.
  • src/MiniExcel.OpenXml/OpenXmlWriter.cs
    • Updated the calculation of maxColumnIndex to filter based on ExcelIgnoreColumn.
    • Modified WriteColumnsWidthsAsync to pass the hidden status from ExcelColumnWidth to the WorksheetXml.Column method.
    • Updated the header printing logic in PrintHeaderAsync to use ExcelIgnoreColumn for skipping ignored columns.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the functionality to hide columns in Excel exports by adding a MiniExcelHiddenAttribute and a Hidden property to MiniExcelColumnAttribute. The implementation is consistent and well-integrated throughout the library. The pull request also includes a refactoring that renames the ExcelIgnore property on MiniExcelColumnMapping to ExcelIgnoreColumn for better clarity. I have provided feedback on a minor documentation issue and the potential breaking change from the property rename.

@michelebastione michelebastione merged commit 26c9228 into mini-software:master Mar 9, 2026
3 checks passed
@michelebastione michelebastione deleted the hidden-columns branch March 9, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

希望能增加导出时可以指定某些列隐藏的支持。

1 participant