Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6129841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:47:22+00:00 2026-05-23T16:47:22+00:00

I’m working with Aspose Cells 2.4 for Java and I’m having some trouble setting

  • 0

I’m working with Aspose Cells 2.4 for Java and I’m having some trouble setting sparklines. This is the code:

CellArea ca = new CellArea();    

for (int k2=5;k2<=100;k2++){        

  ca.setStartColumn(21);
  ca.setEndColumn(21);
  ca.setStartRow(k2);
  ca.setEndRow(k2);

  String range = "Q"+k2+",R"+k2+",S"+k2+",T"+k2;
  int idx = sheet.getSparklineGroupCollection().add(SparklineType.LINE, range, false, ca);
  SparklineGroup group = sheet.getSparklineGroupCollection().get(idx);
  group.setSeriesColor(Color.RED);
}

I’m currently using Excel 2010. When I generate the file, the cells where sparklines are supposed to be are empty.

Thank you very much for your help and sorry for my English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:47:23+00:00Added an answer on May 23, 2026 at 4:47 pm

    I could not find a way to make sparklines work but I made a short method to manually draw a 4 points sparkline. I’m working on making it n-point sparkline with a loop but I got this so far:

    import java.io.IOException;
    import java.util.Arrays;
    
    import com.aspose.cells.MsoLineDashStyle;
    import com.aspose.cells.PlacementType;
    import com.aspose.cells.ShapeLine;
    import com.aspose.cells.Workbook;
    import com.aspose.cells.Worksheet;
    
    
    public class Main {
    public static void main(String[] args) throws IOException{
        Workbook oWorkbook = new Workbook();
    
        Worksheet oWorksheet = oWorkbook.getWorksheets().addSheet("Sparklines");
        oWorksheet.getCells().getCell("A1").setValue(10);
        oWorksheet.getCells().getCell("B1").setValue(10);
        oWorksheet.getCells().getCell("C1").setValue(10);
        oWorksheet.getCells().getCell("D1").setValue(10);
    
        //We get the values from Excel worksheet
        int val1 =  Integer.parseInt(oWorksheet.getCells().getCell("A1").getValue().toString());
        int val2 =  Integer.parseInt(oWorksheet.getCells().getCell("B1").getValue().toString());
        int val3 =  Integer.parseInt(oWorksheet.getCells().getCell("C1").getValue().toString());
        int val4 =  Integer.parseInt(oWorksheet.getCells().getCell("D1").getValue().toString());
    
        //We set ascending sort
        int[] nums={val1,val2,val3,val4};  
        Arrays.sort(nums);  
        System.out.println("Minimum = " + nums[0]);  
        System.out.println("Maximum = " + nums[nums.length-1]);
    
        //constant values
        float height = 17;
        float width = 64;
        float dist = 20; //horizontal offset for each point
    
        //we find a constant to set the proportion between the point values and the cell height
        float con = height/nums[nums.length-1];
        System.out.println("Con = " + con);
    
        //we find the offset values ??relative to the upper edge of the cell
        float point1 = height - val1*con;
        float point2 = height - val2*con;
        float point3 = height - val3*con;
        float point4 = height - val4*con;
    
        //we'll have to round those values up
        int point1_int = Math.round(point1);
        int point2_int = Math.round(point2);
        int point3_int = Math.round(point3);
        int point4_int = Math.round(point4);
    
        System.out.println(point1);
        System.out.println(point2);
        System.out.println(point3);
        System.out.println(point4);
        /**********************************START OF LINE1*********************************************************/
    
        double  oposed_line = point1_int-point2_int;
        System.out.println("oposed_line:"+oposed_line);
    
    
    
        double hipotenusa = Math.sqrt(Math.pow(oposed_line, 2)+Math.pow(dist, 2));
        Math.round(hipotenusa);
        System.out.println("Hipotenusa: "+hipotenusa);
    
        //printing the line
        com.aspose.cells.LineShape line1  = oWorksheet.getShapes().addLine(0,4,2,point1_int, (int)hipotenusa, 0);
    
        //finding rotation_angle
        double rotation_angle =  Math.atan((oposed_line)/dist);
        rotation_angle = Math.toDegrees(rotation_angle);
        System.out.println("Angle 1: "+rotation_angle);
    
        line1.setRotation((float)-rotation_angle);
    
        /**********************************END OF LINE1*********************************************************/
    
    
        /********************************** LINE2*********************************************************/
    
        oposed_line = point2_int-point3_int;
        System.out.println("oposed_line:"+oposed_line);
    
        hipotenusa = Math.sqrt(Math.pow(oposed_line, 2)+Math.pow(dist, 2));
        Math.round(hipotenusa);
        System.out.println("Hipotenusa: "+hipotenusa);
    
    
        com.aspose.cells.LineShape line2  = oWorksheet.getShapes().addLine(0,4,(int)dist,point2_int, (int)hipotenusa, 0);
    
        rotation_angle =  Math.atan((oposed_line)/dist);
        rotation_angle = Math.toDegrees(rotation_angle);
        System.out.println("Angle 2: "+rotation_angle);
    
        line2.setRotation((float)-rotation_angle);
    
        /********************************** LINE2*********************************************************/     
    
    
        /**********************************LINE3*********************************************************/
    
        oposed_line = point3_int-point4_int;
        System.out.println("oposed_line:"+oposed_line);
    
        hipotenusa = Math.sqrt(Math.pow(oposed_line, 2)+Math.pow(dist, 2));
        Math.round(hipotenusa);
        System.out.println("Hipotenusa: "+hipotenusa);
    
    
        int offset = (int) (dist*2);
        com.aspose.cells.LineShape line3  = oWorksheet.getShapes().addLine(0,4,offset,point3_int,(int)hipotenusa, 0);
    
    
        rotation_angle =  Math.atan(oposed_line/dist);
        rotation_angle = Math.toDegrees(rotation_angle);
        System.out.println("Angle 3: "+rotation_angle);
    
        line3.setRotation((float)-rotation_angle);
    
        /**********************************LINE3*********************************************************/
    
        //Set the line dash style
    
        ShapeLine shapeline = line1.getLine();
        ShapeLine shapeline2 = line2.getLine();
        ShapeLine shapeline3 = line3.getLine();
    
    
        shapeline.setDashStyle(MsoLineDashStyle.SOLID);
        shapeline2.setDashStyle(MsoLineDashStyle.SOLID);
        shapeline3.setDashStyle(MsoLineDashStyle.SOLID);
    
        short smallNumber = 3;
        System.out.println(smallNumber);
    
        line1.setLineEndArrowHead(smallNumber);
        line2.setLineEndArrowHead(smallNumber);
        line3.setLineEndArrowHead(smallNumber);
    
    
        //Set the placement.
    
        line1.setPlacement(PlacementType.FREE_FLOATING);
        line2.setPlacement(PlacementType.FREE_FLOATING);
        line3.setPlacement(PlacementType.FREE_FLOATING);
    
        oWorkbook.save("C:\\test3.xlsx");
    
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.