Skip to content

Strip junk styles

Location on ribbon: Tab DVD Addin → Group Cells and Rows

Command ID: btnDeleteCellStyles

What it does

The command opens an Excel file on disk (an xlsx is just a zip) and strips the junk Cell Styles out of xl/styles.xml — every cellStyle entry that is not one of Excel's built-in styles. These pile up when sheets are copied back and forth between workbooks, leaving a Cell Styles gallery thousands of entries long, a bloated file and painfully slow opening.

Use it when a quantity or programme workbook received from another party takes a minute to open, scrolls in jerks, or when Excel reports "Too many different cell formats".

How to use

  1. Close the file you want to clean in Excel — the command rewrites the file on disk, so it must not be open.
  2. Click DVD Addin → Cells and Rows → Strip junk styles.
  3. A file picker titled "Pick xlsx file" appears, filtered to *.xlsx; *.xlsm; *.xlam. Select one file and click OK.
  4. The command processes the file and reports the result: "Removed n junk styles" or "No junk styles found".
  5. Reopen the file and check Home → Cell Styles — the gallery is back to normal.

Example

Construction programme - Package 02.xlsx is 42 MB and takes over a minute to open because sheets from six subcontractors were merged into it. Close the file, run the command, pick the file in the dialog — the message reads "Removed 3,874 junk styles". Reopen it: the Cell Styles gallery holds only Excel's standard styles and the file opens in a few seconds.

Notes

  • The command overwrites the original file in place, makes no backup and cannot be undone — copy the file first when working on signed records.
  • A file currently open in Excel is refused with a message asking you to close the workbook first (OneDrive-synced files are matched by their local path too).
  • Only .xlsx, .xlsm and .xlam are supported. Legacy .xls files must be saved as .xlsx first.
  • Only the surplus style definitions are removed; direct cell formatting (font, fill, borders) is untouched.
  • If the file has no xl/styles.xml or no junk styles, the command reports that and leaves the file unchanged.

Released under DVDAddin License.