-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(test): add test for debugging issues on merged cells
See qrilka/xlsx#142
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module DebugMergeCells where | ||
|
||
import qualified Codec.Xlsx as X | ||
import qualified Codec.Xlsx.Formatted as XF | ||
import qualified Codec.Xlsx.Tabulate as XT | ||
import Control.Lens ((?~)) | ||
import qualified Control.Lens as L | ||
import qualified Data.ByteString.Lazy as BL | ||
import Data.Function ((&)) | ||
import qualified Data.Map.Strict as HM | ||
import qualified Data.Text as T | ||
import Data.Time.Clock.POSIX (getPOSIXTime) | ||
|
||
|
||
debugMergeCells :: XT.SimpleFormatTable -> XT.SimpleFormatTable -> IO BL.ByteString | ||
debugMergeCells sft1 sft2 = do | ||
ct <- getPOSIXTime | ||
let (fcm1, range) = XT.preformatWithTitleXY 1 1 id "Deneme1" sft1 | ||
let (fcm2, range) = XT.preformatWithTitleXY 20 1 id "Deneme2" sft2 | ||
let xlsx = XF.formatWorkbook [("Sheet 1", fcm1), ("Sheet 2", fcm2)] X.minimalStyleSheet | ||
print xlsx | ||
pure (X.fromXlsx ct xlsx) | ||
|
||
|
||
-- addHeader | ||
-- :: Int -- ^ The row to put the header at. | ||
-- -> Int -- ^ The column to put the header at. | ||
-- -> Int -- ^ Number of | ||
-- -> (XF.FormattedCell -> XF.FormattedCell) | ||
-- -> T.Text | ||
-- -> HM.Map (Int, Int) XF.FormattedCell | ||
-- -> HM.Map (Int, Int) XF.FormattedCell | ||
-- addHeader row col colspan formatter text cellmap = withColspan n . fmtHead | ||
-- where | ||
-- fillp = X.def & X.fillPatternBgColor ?~ (X.def & X.colorARGB ?~ "FF000080") | ||
-- fmtBold = XF.formattedFormat . XF.formatFont . L.non X.def . X.fontBold ?~ True | ||
-- fmtItal = XF.formattedFormat . XF.formatFont . L.non X.def . X.fontItalic ?~ True | ||
-- fmtBcol = XF.formattedFormat . XF.formatFill . L.non X.def . X.fillPattern ?~ fillp | ||
-- fmtHead = fmtBold . fmtItal . fmtBcol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters