@@ -421,6 +421,14 @@ internal static extern IntPtr MergeCell(
421421 [ MarshalAs ( UnmanagedType . LPUTF8Str ) ] string bottomRightCell
422422 ) ;
423423
424+ [ DllImport ( LibraryName , CallingConvention = CallingConvention . Cdecl ) ]
425+ internal static extern IntPtr UnmergeCell (
426+ long fileIdx ,
427+ [ MarshalAs ( UnmanagedType . LPUTF8Str ) ] string sheet ,
428+ [ MarshalAs ( UnmanagedType . LPUTF8Str ) ] string topLeftCell ,
429+ [ MarshalAs ( UnmanagedType . LPUTF8Str ) ] string bottomRightCell
430+ ) ;
431+
424432 [ DllImport ( LibraryName , CallingConvention = CallingConvention . Cdecl ) ]
425433 internal static extern IntPtr MoveSheet (
426434 long fileIdx ,
@@ -6338,6 +6346,37 @@ public void UngroupSheets()
63386346 throw new RuntimeError ( err ) ;
63396347 }
63406348
6349+ /// <summary>
6350+ /// UnmergeCell provides a function to unmerge a given range reference.
6351+ /// <example>
6352+ /// For example unmerge range reference D3:E9 on Sheet1:
6353+ /// <code>
6354+ /// try
6355+ /// {
6356+ /// f.UnmergeCell("Sheet1", "D3", "E9");
6357+ /// }
6358+ /// catch (RuntimeError err)
6359+ /// {
6360+ /// Console.WriteLine(err.Message);
6361+ /// }
6362+ /// </code>
6363+ /// </example>
6364+ /// </summary>
6365+ /// <param name="sheet">The worksheet name</param>
6366+ /// <param name="topLeftCell">The top-left cell reference</param>
6367+ /// <param name="bottomRightCell">The bottom-right cell reference</param>
6368+ /// <remarks>Attention: overlapped range will also be unmerged</remarks>
6369+ /// <exception cref="RuntimeError">Return None if no error occurred,
6370+ /// otherwise raise a RuntimeError with the message.</exception>
6371+ public void UnmergeCell ( string sheet , string topLeftCell , string bottomRightCell )
6372+ {
6373+ string err = Marshal . PtrToStringUTF8 (
6374+ Lib . UnmergeCell ( FileIdx , sheet , topLeftCell , bottomRightCell )
6375+ ) ;
6376+ if ( ! string . IsNullOrEmpty ( err ) )
6377+ throw new RuntimeError ( err ) ;
6378+ }
6379+
63416380 /// <summary>
63426381 /// UnsetConditionalFormat provides a function to unset the conditional
63436382 /// format by given worksheet name and range reference.
0 commit comments