Borders of vertically merged cells appear correctly only in preview, not in rendered PDF
11:19 29 Dec 2025

I am generating a PDF from R Markdown using flextable.
When I vertically merge cells, the borders of the merged cells appear correctly in the preview, but they do not appear correctly in the rendered PDF.The pdf contains the borders that it shouldn't be.

This behavior changed after upgrading flextable.
Up to flextable 0.9.7, merged cell borders rendered correctly everywhere (preview and in pdf as they say here ).
Starting with newer versions, fix_border_issues() was introduced to address this, but the issue still persists for me.

My toy example to demonstrate the issue is (RMarkdown):

---
title: "Untitled"
output:
  pdf_document:
    latex_engine: xelatex
date: "2025-12-29"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
suppressMessages(library(flextable))
suppressMessages(library(officer))
```{r, echo=FALSE, warning=FALSE, message=FALSE, fig.width=9, fig.height=3, dpi=1200}
library(tibble)

new_tbl <- tibble(
  Country = c("USA", "USA", "USA", "USA", "USA", "USA", "USA"),
  Project = c("a", "b", "c", "c", "d", "d", "d"),
  Client  = c("A1", "A2", "A3", "A3", "A4", "A5", "A6"),
  status  = c("no", "no", "yes", "no", "yes", "yes", "yes")
)

border_style <- officer::fp_border(color = "#D9E1F2", width = 2)

FT_LIST <- new_tbl %>%
  flextable() %>%
  merge_v(j = "Country") %>%
  merge_v(j = "Project") %>%
  border_outer(border = border_style, part = "all") %>%
  border(j = 2:4, border = border_style) %>%
  bold(part = "header") %>%
  bg(part = "header", bg = "#1F4E78") %>%
  color(part = "header", color = "#FFFFFF") %>%
  bold(j = 1, part = "body") %>%
  align(j = 1, align = "center", part = "body") %>%
  fontsize(size = 6, part = "all") %>%
  bg(j = 1, bg = "white", part = "body")

# Attempt to fix merged-cell borders
FT_LIST <- flextable::fix_border_issues(FT_LIST)

FitFlextableToPage <- function(ft, pgwidth){
  ft_out <- flextable::autofit(ft)
  flextable::width(
    ft_out,
    width = dim(ft_out)$widths * pgwidth / sum(dim(ft_out)$widths)
  )
}

FitFlextableToPage(FT_LIST, 7)

enter image description here

r-markdown officer flextable