Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: How to format Fractions

$
0
0
Try to use this function:


Public Function CalcFraction(ByVal eString As String) As String
Dim TestBook As New XLWorkbook
Dim testworksheet = TestBook.Worksheets.Add("test")
testworksheet.Cell("a1").Value = eString
testworksheet.Cell("a1").Style.NumberFormat.Format = "# ???/???"
TestBook.CalculateMode = XLCalculateMode.Auto
Return TestBook.Evaluate(TestBook.Worksheets.Worksheet("test").Cell("a1").GetFormattedString)
End Function

to be given - 1/2 + 1/4 and get 3/4

Thanks for all your help!!!

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>