Skip to content

How to Resolve the Issue of Original Cell Borders Disappearing When Using Excelize? #2061

@DeveloperJo

Description

@DeveloperJo

In the MS Excel program, I set borders for individual cells.
image

Then, I applied borders to the same cells using the rules in "Conditional Formatting."

image
image
image

After saving and closing the Excel file, when I reopen it and save it again using Excelize, only the borders set through "Conditional Formatting" remain, while the original cell borders disappear.
image

I will attach the test file and provide the source code I developed in Golang.
test.xlsx

package main

import (
	"flag"
	"fmt"

	"github.com/xuri/excelize/v2"
)

func main() {
   file_name := flag.String("file", "", "Input file Name")
   flag.Parse()

   fmt.Println(*file_name, *order_code)

   f, err := excelize.OpenFile(*file_name)
   if err != nil {
      fmt.Println(err)
      return
   }

   tables, err := f.GetTables("Sheet1")
   if err != nil {
      fmt.Println(err)
      return
   }

   fmt.Println(tables)

   if err := f.SaveAs("test1.xlsx",); err != nil {
      fmt.Println(err)
   }
}

Is there a way to resolve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions